cirron 0.2.5 → 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 +17 -27
  3. data/cirron.gemspec +1 -1
  4. data/lib/tracer.rb +2 -2
  5. metadata +15 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fed1adda77ca40210f3cf1df4a4f3d3cbc0c73a8867d20eb56a74ae12bdfa1f
4
- data.tar.gz: 806b8d8bca6b7491d86924f83b1194ac6be03b0dfab1ff887e157e380f19ccfe
3
+ metadata.gz: d920f56abf72180172ea62f52d9c039612353d5238ab75fc9d872549ec486ffb
4
+ data.tar.gz: 0f3a133a9e2f2ffa6ebc921f951333ed3cc3c89215cbd837edd096e9bf2d50a7
5
5
  SHA512:
6
- metadata.gz: b87c86b710e56227512fbcc0938c0a1bbbb028e2366cc4f90123d759937dcd3aa64bca0f603f9269e50b633714b859c8ef563e541808f2c68a305a882a548074
7
- data.tar.gz: 5b2024455cdc4591d7db609db12fa00b5be333a4d9ed09a2873a8212ba6909c84ab301b16563fe34af5464551f070df2960f50a792b68a38d570b9f6653217dc
6
+ metadata.gz: 82a78d5e9644dc363bf17ff83bd9beea08e4bd64ab1033d2cd5b5c1c01d74d7a3c8cdfaecfe49352eebfd858933dac898209b63897bcbe194ac09e3f8f77ad72
7
+ data.tar.gz: 987c0a0e93683f23b79846aff8fae8a9a2f4c274c66165852311da08cbdcc0b8cea3594ef6d67df9b8b8beaf9657535d8456e69a810dcc5778de5f69bdbdc3fe
data/README.md CHANGED
@@ -1,53 +1,43 @@
1
- == Cirron
1
+ = Cirron
2
2
 
3
3
  Cirron measures a piece of Ruby code and reports back several performance counters:
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
7
  It can also trace syscalls using +strace+, Linux only!
9
8
 
10
-
11
9
  == Prerequisites
12
10
 
13
11
  * Linux with perf events support / Apple ARM OSX
14
12
  * C++
15
13
  * Ruby 3.x
16
14
 
17
-
18
15
  == Usage
19
16
 
20
17
  === Performance Counters
21
-
22
-
23
- require 'cirron'
18
+ $ sudo irb
19
+ irb> require 'cirron'
24
20
 
25
21
  # Start collecting performance metrics
26
- Cirron::Collector.new do |collector|
27
- # Your code here
28
- # ...
29
- end
30
-
31
- # Retrieve the metrics
32
- puts collector.counters
33
-
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)
34
27
 
35
28
  === Syscalls
36
29
 
30
+ $ sudo irb
31
+ irb> require 'cirron'
37
32
 
38
- require 'cirron'
39
-
40
- Cirron::Tracer.new do |tracer|
41
- # Your code here
42
- # ...
43
- end
44
-
45
- # Stop collecting and retrieve the trace
46
- puts tracer.trace
47
-
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">]
48
38
  # Save the trace for ingesting to Perfetto
49
- File.write("/tmp/trace", Cirron.to_tef(trace))
50
-
39
+ irb> File.write("/tmp/trace", Cirron::to_tef(trace))
40
+ => 267
51
41
 
52
42
  == Additional Information
53
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.5"
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.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Stuchlik
@@ -10,19 +10,22 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2024-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: "== Cirron\n\nCirron measures a piece of Ruby code and reports back several
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\nIt can also trace syscalls using +strace+, Linux only!\n\n\n== Prerequisites\n\n*
17
- Linux with perf events support / Apple ARM OSX\n* C++\n* Ruby 3.x\n\n\n== Usage\n\n===
18
- Performance Counters\n\n\n require 'cirron'\n\n # Start collecting performance
19
- metrics\n Cirron::Collector.new do |collector|\n # Your code here\n # ...\n
20
- \ end\n\n # Retrieve the metrics\n puts collector.counters\n\n\n=== Syscalls\n\n\n
21
- \ require 'cirron'\n\n Cirron::Tracer.new do |tracer|\n # Your code here\n #
22
- ...\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==
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: []