chariot 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +72 -0
  4. data/lib/chariot/version.rb +5 -0
  5. metadata +49 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ec689a23a3903f34656d8c3af1234fef065fe997b1c7451962157b54da2a6517
4
+ data.tar.gz: 69a1c2fdd6b6be1e6ab77961af6ede257fb84b9d29448a47552f06da21424a94
5
+ SHA512:
6
+ metadata.gz: b5555a7ca082c177509b38136587e625ae2cbaf9b461c714ec521ad15c81b6ead0ed07c1eaf9cefe8bc5843fd984559708a8642c5bbf66c029052bfa9d08ab6d
7
+ data.tar.gz: 5089a7cb62500655cbb39c2bd57f1a3141b15ca9e8552542a064549d422baee43f54e4cbbc3a86903bf50792e46a570263a720820c47fc0a900d3b9b2a4b0f11
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Fingertips
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,72 @@
1
+ # Chariot
2
+
3
+ Ruby wrapper for `os_signposts` used to record events and intervals and show them using Xcode Instruments.
4
+
5
+ ## Installation
6
+
7
+ Install a recent version of Xcode either through the developer portal or the App Store. Once installed you can start Xcode Instruments through Xcode or you can find it at:
8
+
9
+ /Applications/Xcode.app/Contents/Applications/Instruments.app
10
+
11
+ ## Usage
12
+
13
+ First you need to come up with a unique subsystem identifier so you don't get in the way of other systems or applications using the same naming as yours.
14
+
15
+ Our example is for a fictive application called ‘Yellow’.
16
+
17
+ ```ruby
18
+ SUBSYSTEM = 'com.fngtps.yellow'
19
+ ```
20
+
21
+ ### Logs
22
+
23
+ Next we need to decide on a category and initialize a log for it. There is no overhead for creating logs other than memory allocation.
24
+
25
+ ```ruby
26
+ log = Chariot::Log.new(SUBSYSTEM, "Redis Connection")
27
+ ```
28
+
29
+ ### Events
30
+
31
+ You can either emit an event or record the start or end of an interval. These pieces of data will later be pieced together in Instruments. Let's look at an event first.
32
+
33
+ ```ruby
34
+ log.emit("Open")
35
+ ```
36
+
37
+ When you are emitting large volume of events it's slightly better for performance to create a topic.
38
+
39
+ ```ruby
40
+ topic = Chariot::Topic.new(log, "Open")
41
+ topic.emit
42
+ ```
43
+
44
+ An event might have some important details so you can also supply them in the form a string.
45
+
46
+ ```ruby
47
+ topic.emit(message: "host: #{redis.host}, port: #{redis.port}")
48
+ ```
49
+
50
+ ### Intervals
51
+
52
+ Recording an interval is useful because it allows us to see if certain things happen at the same time. An interval is kind of like an event with a duration so when you use the same name they will appear associated in Instruments.
53
+
54
+ ```ruby
55
+ log.start("Open", message: "index: #{index}")
56
+ redis = open_connection
57
+ log.stop("Open", message: "object_id: #{redis.object_id}")
58
+ ```
59
+
60
+ You can also use the block syntax so you don't have to repeat the
61
+
62
+ ```ruby
63
+ log.interval("Open") do
64
+ redis = open_connection
65
+ end
66
+ ```
67
+
68
+ Or you can combine both the topic and block approach:
69
+
70
+ ```ruby
71
+ topic.interval { redis = open_connection }
72
+ ```
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chariot
4
+ VERSION = '0.0.1'
5
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chariot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Manfred Stienstra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby wrapper for os_signposts used to record events and intervals and
14
+ show them using Xcode Instruments.
15
+ email:
16
+ - manfred@fngtps.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files:
20
+ - README.md
21
+ - LICENSE
22
+ files:
23
+ - LICENSE
24
+ - README.md
25
+ - lib/chariot/version.rb
26
+ homepage: http://github.com/Fingertips/chariot
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.0.3
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Ruby wrapper for os_signposts
49
+ test_files: []