cirron 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -32
- data/cirron.gemspec +1 -1
- data/lib/tracer.rb +2 -2
- metadata +14 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '031948c5f88eb541e318a992ec6c99d534f703a2e372082c6b07ed2b4e7783f2'
|
4
|
+
data.tar.gz: 79ad0542a7e65819008b65e053250d073b5c87a8f4923c1ae8a64fdd2f15cf10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0a263836ee39db7e6723aeb78a71da0d4bdc6536d9a79463a2dd312c3fa0ff3737f233d7c4e8b9a2c26957678565e4eebc400e827f206088c5c87d28e7ba1f4
|
7
|
+
data.tar.gz: d081b2b307ed89ddf06735be9c547383ea42de2129a365d910f72b19b298373a4cb94ad011cee20e7d5db793436067d0a9e1cdc42947c00e380455f598444e69
|
data/README.md
CHANGED
@@ -4,53 +4,40 @@ Cirron measures a piece of Ruby code and reports back several performance counte
|
|
4
4
|
CPU instruction count, branch misses, page faults and time spent measuring.
|
5
5
|
It uses the Linux perf events interface or @ibireme's KPC demo[https://gist.github.com/ibireme/173517c208c7dc333ba962c1f0d67d12] on OSX.
|
6
6
|
|
7
|
-
---
|
8
|
-
|
9
7
|
It can also trace syscalls using +strace+, Linux only!
|
10
8
|
|
11
|
-
---
|
12
|
-
|
13
9
|
== Prerequisites
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
---
|
11
|
+
- Linux with perf events support / Apple ARM OSX
|
12
|
+
- C++
|
13
|
+
- Ruby 3.x
|
20
14
|
|
21
15
|
== Usage
|
22
16
|
|
23
17
|
=== Performance Counters
|
24
|
-
|
25
|
-
require 'cirron'
|
18
|
+
$ sudo irb
|
19
|
+
irb> require 'cirron'
|
26
20
|
|
27
21
|
# Start collecting performance metrics
|
28
|
-
Cirron::
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
# Retrieve the metrics
|
34
|
-
puts collector.counters
|
35
|
-
|
36
|
-
---
|
22
|
+
irb> counters = Cirron::collector do
|
23
|
+
irb> # Your code here
|
24
|
+
irb> puts "Hello"
|
25
|
+
irb> end
|
26
|
+
=> Counter(time_enabled_ns: 0, instruction_count: 39066, branch_misses: 546, page_faults: 0)
|
37
27
|
|
38
28
|
=== Syscalls
|
39
29
|
|
40
|
-
|
41
|
-
|
42
|
-
Cirron::Tracer.new do |tracer|
|
43
|
-
# Your code here
|
44
|
-
# ...
|
45
|
-
end
|
46
|
-
|
47
|
-
# Stop collecting and retrieve the trace
|
48
|
-
puts tracer.trace
|
30
|
+
$ sudo irb
|
31
|
+
irb> require 'cirron'
|
49
32
|
|
33
|
+
irb> trace = Cirron::tracer do
|
34
|
+
irb> # Your code here
|
35
|
+
irb> puts "Hello"
|
36
|
+
irb> end
|
37
|
+
=> [#<Syscall:0x00007c6c1a4b3608 @args="1, [{iov_base=\"Hello\", iov_len=5}, {iov_base=\"\\n\", iov_len=1}], 2", @duration="0.000201", @name="writev", @pid="2261962", @retval="6", @timestamp="1720285300.334976">]
|
50
38
|
# Save the trace for ingesting to Perfetto
|
51
|
-
File.write("/tmp/trace", Cirron
|
52
|
-
|
53
|
-
---
|
39
|
+
irb> File.write("/tmp/trace", Cirron::to_tef(trace))
|
40
|
+
=> 267
|
54
41
|
|
55
42
|
== Additional Information
|
56
43
|
|
data/cirron.gemspec
CHANGED
data/lib/tracer.rb
CHANGED
@@ -118,7 +118,7 @@ module Cirron
|
|
118
118
|
|
119
119
|
# Parse the trace file into a list of events
|
120
120
|
trace = File.open(trace_file.path, 'r') do |file|
|
121
|
-
parse_strace(
|
121
|
+
parse_strace(file)
|
122
122
|
end
|
123
123
|
|
124
124
|
trace = filter_trace(trace, trace_file.path + ".dummy")
|
@@ -128,7 +128,7 @@ module Cirron
|
|
128
128
|
trace
|
129
129
|
end
|
130
130
|
|
131
|
-
def to_tef(parsed_events)
|
131
|
+
def self.to_tef(parsed_events)
|
132
132
|
events = parsed_events.map do |event|
|
133
133
|
case event
|
134
134
|
when Syscall
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cirron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Stuchlik
|
@@ -13,16 +13,19 @@ dependencies: []
|
|
13
13
|
description: "= Cirron\n\nCirron measures a piece of Ruby code and reports back several
|
14
14
|
performance counters: \nCPU instruction count, branch misses, page faults and time
|
15
15
|
spent measuring. \nIt uses the Linux perf events interface or @ibireme's KPC demo[https://gist.github.com/ibireme/173517c208c7dc333ba962c1f0d67d12]
|
16
|
-
on OSX.\n\
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
\
|
24
|
-
|
25
|
-
|
16
|
+
on OSX.\n\nIt can also trace syscalls using +strace+, Linux only!\n\n== Prerequisites\n\n-
|
17
|
+
Linux with perf events support / Apple ARM OSX\n- C++\n- Ruby 3.x\n\n== Usage\n\n===
|
18
|
+
Performance Counters\n $ sudo irb\n irb> require 'cirron'\n\n # Start collecting
|
19
|
+
performance metrics\n irb> counters = Cirron::collector do\n irb> # Your code
|
20
|
+
here\n irb> puts \"Hello\"\n irb> end\n => Counter(time_enabled_ns: 0, instruction_count:
|
21
|
+
39066, branch_misses: 546, page_faults: 0)\n\n=== Syscalls\n\n $ sudo irb\n irb>
|
22
|
+
require 'cirron'\n\n irb> trace = Cirron::tracer do\n irb> # Your code here\n
|
23
|
+
\ irb> puts \"Hello\"\n irb> end\n => [#<Syscall:0x00007c6c1a4b3608 @args=\"1,
|
24
|
+
[{iov_base=\\\"Hello\\\", iov_len=5}, {iov_base=\\\"\\\\n\\\", iov_len=1}], 2\",
|
25
|
+
@duration=\"0.000201\", @name=\"writev\", @pid=\"2261962\", @retval=\"6\", @timestamp=\"1720285300.334976\">]\n
|
26
|
+
\ # Save the trace for ingesting to Perfetto\n irb> File.write(\"/tmp/trace\",
|
27
|
+
Cirron::to_tef(trace))\n => 267\n\n== Additional Information\n\nFor more detailed
|
28
|
+
information, please visit the project's GitHub page: https://github.com/s7nfo/Cirron"
|
26
29
|
email:
|
27
30
|
- matej.stuchlik@gmail.com
|
28
31
|
executables: []
|