jemal 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77f60c008c7ce2c7830ad626989eadcee68e7b65
4
- data.tar.gz: 092152b3eb68c593cc1078f2425a74358a261332
3
+ metadata.gz: 8763d95283d7068ebddb436e87e8a7fbd0ee6cc0
4
+ data.tar.gz: d5b9c2fa8bfacb26f60099c3538245c956425407
5
5
  SHA512:
6
- metadata.gz: 1e0a37a570b342421d8c655b8598625177a6b3ce229739472aed54aa6314919e0666bfd7cf72186cb8949133e137799a9ee7a97365b8ec010be1e5d2f8ceffac
7
- data.tar.gz: 80fb210de552cdb7513d4de2c54be69f9fdcc834d5c2c432ac2ff4b81a3ed9fefd4febbe6b4a64b3c150e4236800fd949c8ff8114829f308cadfa5c9e48e48dd
6
+ metadata.gz: de843bfd2ece8662a1a6c97565d4261335a5ce1ff7aef2e665a3875658f4b8ae7c3e336b7f1e630dbd27530b831d4c52c3fa31b4e6112ad01ecd1abace403ea0
7
+ data.tar.gz: 1589fbd6532e3cbfdbca688a140a4a0f798fb090f64630ec1bff794f718597e50267d38658243699606acf16fa5c853d9602b4e08dc77b54fe203b129a47467f
data/lib/jemal.rb CHANGED
@@ -153,7 +153,11 @@ module Jemal
153
153
  # Public: Get current statistics.
154
154
  #
155
155
  # Returns stats as one big Hash.
156
- def self.stats
156
+ def self.stats(refresh: true)
157
+ if refresh
158
+ write_uint64("epoch", 1)
159
+ end
160
+
157
161
  res = {}
158
162
 
159
163
  GLOBAL_STATS.each { |s| res[s] = get_size_t("stats.#{s}") }
@@ -62,6 +62,17 @@ module Jemal
62
62
  ptr.read_uint64
63
63
  end
64
64
 
65
+ # Private: Use mallctl to write unsigned 64-bit value.
66
+ #
67
+ # name - the String with parameter name.
68
+ #
69
+ # Returns nothing.
70
+ def write_uint64(name, value)
71
+ ptr = FFI::MemoryPointer.new :uint64
72
+ ptr.write_uint64 value
73
+ mallctl name, nil, nil, ptr, ptr.size
74
+ end
75
+
65
76
  # Private: Use mallctl to read size_t value.
66
77
  #
67
78
  # name - the String with parameter name.
data/lib/jemal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jemal
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jemal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - oleg dashevskii