⚲
プロジェクト
全般
プロフィール
ログイン
登録する
ホーム
プロジェクト
ヘルプ
検索
:
mikutter
全プロジェクト
mikutter
概要
活動
ロードマップ
チケット
ニュース
Wiki
リポジトリ
ダウンロード (960 Bytes)
最適化 #564
» memory_tracker.rb
Takuma Nakajima
, 2013-02-14 17:04
Plugin
.
create
:memory_tracker
do
def
memory_profile
GC
.
start
str
=
Time
.
now
.
strftime
(
"%Y%m%d%H%M%S"
).
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
Mutex
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
User
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
Time
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
Data
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
RubyVM
::
InstructionSequence
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
RubyVM
::
Env
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
Proc
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
Hash
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
Array
).
count
.
to_s
str
+=
"
\t
"
+
ObjectSpace
.
each_object
(
String
).
count
.
to_s
str
end
def
update_profile
f
=
open
(
"/dev/shm/mikutter_objs.log"
,
"a"
)
f
.
write
(
memory_profile
+
"
\n
"
)
f
.
close
end
Thread
.
new
{
loop
do
update_profile
sleep
30
end
}
end
« 前
1
2
3
次 »
(2-2/3)
ロード中...