cirron 0.2.6 → 0.2.7

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -29
  3. data/cirron.gemspec +1 -1
  4. data/lib/tracer.rb +2 -2
  5. metadata +14 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c6c65fcba8e45502f5b64fc1ed150c3685ac487d788309d45c81be29a028da2
4
- data.tar.gz: b3c3d949d138853c0f5a7bf46fd8fe9ebf83bb957d72d28087b059686a14a122
3
+ metadata.gz: d920f56abf72180172ea62f52d9c039612353d5238ab75fc9d872549ec486ffb
4
+ data.tar.gz: 0f3a133a9e2f2ffa6ebc921f951333ed3cc3c89215cbd837edd096e9bf2d50a7
5
5
  SHA512:
6
- metadata.gz: c9f45039a22835fd70ada492f8ad3bf85358f8186d4088886e52cf7ba8bab3e65fab566c6992a6cc6602ce9b9c7a0b2e1426590a263d414b94aebcf0cffe2c94
7
- data.tar.gz: 5aa6c080a082f99090f613f37455a3e3f4afeff43a4e04a303aff42e130fb49a8d413afb8b1223a110dc44087c7ee6dcdaeb7a8f0a08869f924035ba5a038cba
6
+ metadata.gz: 82a78d5e9644dc363bf17ff83bd9beea08e4bd64ab1033d2cd5b5c1c01d74d7a3c8cdfaecfe49352eebfd858933dac898209b63897bcbe194ac09e3f8f77ad72
7
+ data.tar.gz: 987c0a0e93683f23b79846aff8fae8a9a2f4c274c66165852311da08cbdcc0b8cea3594ef6d67df9b8b8beaf9657535d8456e69a810dcc5778de5f69bdbdc3fe
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
11
  * Linux with perf events support / Apple ARM OSX
16
12
  * C++
17
13
  * Ruby 3.x
18
14
 
19
- ---
20
-
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::Collector.new do |collector|
29
- # Your code here
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
- require 'cirron'
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.to_tef(trace))
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
@@ -6,7 +6,7 @@ require 'pathname'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "cirron"
9
- spec.version = "0.2.6"
9
+ spec.version = "0.2.7"
10
10
  spec.authors = ["Matt Stuchlik"]
11
11
  spec.email = ["matej.stuchlik@gmail.com"]
12
12
 
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(trace)
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.6
4
+ version: 0.2.7
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\n---\n\nIt can also trace syscalls using +strace+, Linux only!\n\n---\n\n==
17
- Prerequisites\n\n* Linux with perf events support / Apple ARM OSX\n* C++\n* Ruby
18
- 3.x\n\n---\n\n== Usage\n\n=== Performance Counters\n\n require 'cirron'\n\n #
19
- Start collecting performance metrics\n Cirron::Collector.new do |collector|\n #
20
- Your code here\n # ...\n end\n\n # Retrieve the metrics\n puts collector.counters\n\n---\n\n===
21
- Syscalls\n\n require 'cirron'\n\n Cirron::Tracer.new do |tracer|\n # Your code
22
- here\n # ...\n end\n\n # Stop collecting and retrieve the trace\n puts tracer.trace\n\n
23
- \ # Save the trace for ingesting to Perfetto\n File.write(\"/tmp/trace\", Cirron.to_tef(trace))\n\n---\n\n==
24
- Additional Information\n\nFor more detailed information, please visit the project's
25
- GitHub page: https://github.com/s7nfo/Cirron"
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: []