Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/lib/ezmetrics.rb +4 -4
  4. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: 0affbdfcda841ffe4eec9105ded5526b13d209ccf0aa564e1b84c91651079d0e
4
- data.tar.gz: 8c0f3879ee0f2cedeba7f6b0526f679ef9962e2270c7639837821f226a0f3580
3
+ metadata.gz: 61d26fa5d7a779917ac2ba154e82f29745a22b64261442117d15b286d0e06276
4
+ data.tar.gz: 44ff087c54cf0e5fdf8763b88deaa59f3ccdfa1e11c12ab5c1da2eebdeea7764
5
5
SHA512:
6
- metadata.gz: 28d6883722e140005b24071ab637104d6d0e16e22a75fffac734b242fafbb88c1ecdbfd4d4d44a11439a8cbac5d0ad5dcfba705ed26a706f6abb83f55f3f5513
7
- data.tar.gz: b02ddcabf2669f9458a21dd37e0495218eedff6f15047c923b81d6fbcd311ce34ed2d27c7ea664a97aebaf806eac653dd4ec09fb3ee526607da796ec4c3a54f2
6
+ metadata.gz: 6bf28edd6c644648198905bcdf50a77a0083c53b6eba312b709e9c1cb951adba1c407cbc28ac3ae0588b15185b5aa0132ef1f568ff30af0158b770d388460885
7
+ data.tar.gz: a08685fea3025b23e5dca7439e9b7f4f2313933363b01a716e68eba800e4b96fce0d976cf25111c0e7a36f655abb6497e3481d39caba881b2ee706e49958b365
data/README.md CHANGED
@@ -219,6 +219,8 @@ EZmetrics.new.show(views: :avg, :db: [:avg, :max], requests: true)
219
219
220
220
### Partitioning
221
221
222
+ If you want to visualize your metrics by using a **line chart**, you will need to use partitioning.
223
+
222
224
To aggregate metrics, partitioned by a unit of time you need to call `partition_by({time_unit})` before calling `show`
223
225
224
226
```ruby
@@ -299,9 +301,9 @@ EZmetrics::Benchmark.new.measure_aggregation(:minute)
299
301
| Interval | Duration (seconds) |
300
302
| :------: | :----------------: |
301
303
| 1 minute | 0.0 |
302
- | 1 hour | 0.05 |
303
- | 12 hours | 0.74 |
304
- | 24 hours | 2.12 |
305
- | 48 hours | 4.85 |
304
+ | 1 hour | 0.04 |
305
+ | 12 hours | 0.53 |
306
+ | 24 hours | 1.59 |
307
+ | 48 hours | 3.51 |
306
308
307
309
The benchmarks above were run on a _2017 Macbook Pro 2.9 GHz Intel Core i7 with 16 GB of RAM_
data/lib/ezmetrics.rb CHANGED
@@ -114,10 +114,10 @@ class EZmetrics
114
114
115
115
def second_to_partition_unit(time_unit, second)
116
116
return second if time_unit == :second
117
- time_unit_depth = { minute: 4, hour: 3, day: 2 }
118
- reset_depth = time_unit_depth[time_unit]
119
- time_to_array = Time.at(second).to_a[0..5].reverse
120
- Time.new(*time_to_array[0..reset_depth]).to_i
117
+ time = Time.at(second)
118
+ return (time - time.sec - time.min * 60 - time.hour * 3600).to_i if time_unit == :day
119
+ return (time - time.sec - time.min * 60).to_i if time_unit == :hour
120
+ (time - time.sec).to_i
121
121
end
122
122
123
123
def interval_metrics
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: ezmetrics
3
3
version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
platform: ruby
6
6
authors:
7
7
- Nicolae Rotaru
@@ -76,11 +76,10 @@ files:
76
76
- README.md
77
77
- lib/ezmetrics.rb
78
78
- lib/ezmetrics/benchmark.rb
79
- homepage: https://nyku.github.io/ezmetrics
79
+ homepage: https://github.com/nyku/ezmetrics
80
80
licenses:
81
81
- GPL-3.0
82
- metadata:
82
+ metadata: {}
83
- source_code_uri: https://github.com/nyku/ezmetrics
84
83
post_install_message:
85
84
rdoc_options: []
86
85
require_paths: