-
Notifications
You must be signed in to change notification settings - Fork 6
/
perftools.txt
94 lines (67 loc) · 1.77 KB
/
perftools.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Sass
====
Chris Eppstein
@chriseppstein
Compass is on top of sass.
Rationale
Syntax
Best Practices
Sass is a compiler that generates CSS
CoffeeScript by Trevor Burnham at 11:35
Functions, variables, mixins, partials
Performance
===========
Linux:
* lsof
* strace
* ltrace
C code:
* perftools
* gdb
Networks:
* tcpdump
* ngrep
CPU:
* bleak_house
* gdb.rb
* memprof
Get the slides: http://speakerdeck.com/u/tmm1/p/debugging-ruby-performance
---
lsof (list open files for a pid)
shows app, ruby, shared libraries, file descriptors (0, 1, 2 are stdin, stdout, stderr)
tcpdump (dump tcp packets)
tcpdump -i eth0 -s 0 -nqA tcp dst port 3306
tcpdump -w <file>, load it up in WireShark
strace (trace system calls and signals)
A system call is a call that happens in system space not user space
-c: count and summarize
-p pid: attach to pid and trace.
stracing ruby: SIGVTALRM is sent every 10 ms (Ruby 1.8)
stracing ruby: sigprocmask
stracing ruby: tests -- result, posix_spawn gem sped up tests by 2x
ltrace (trace library calls)
A library call is a call that happens in user space (C)
rbtrace (trace ruby method calls)
require 'rbtrace'
rbtrace -p pid -m method
rbtrace -c <predefinedtracer>
perftools (Google's performance tools), a suite
CPUPROFILE, pprof
perftools.rb (perftools for Ruby code)
github.com/tmm1/perftools.rb
Can do "wall-clock" time
Can also count objects created
rack-perftools (rack middleware for perftools.rb)
Adds URLs to your app (?profile=true)
gdb (the GNU debugger)
gdb <executable>
gdb <executable> <pid>
"where" "backtrace"
gdb.rb (gdb with MRI hooks)
gem install gdb.rb
"ruby objects classes"
memprof (heap visualizer for ruby)
analyze json output with mongodb/couchdb, jsawk/grep
memprof.com
"ab" tool
hotspots (a performance tool for rails)