⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
mikutter
All Projects
mikutter
Overview
Activity
Roadmap
Issues
News
Wiki
Repository
Download (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
« Previous
1
2
3
Next »
(2-2/3)
Loading...