polyphony 0.61 → 0.62

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7056ec954b2264a15f88934d2b1e65f53c76c301453851ceadf60715570e474
4
- data.tar.gz: 1cd5835b7a5a3d4036e1eabf45ded2e09efdc7cacb207fc0a1a60ac67da02d90
3
+ metadata.gz: 2cea172818871812ebbafcbee0a4b98d130a351f904d7732a02400ef363eac62
4
+ data.tar.gz: f4ef85515436a463d3732f04bbef457426f267fac01f5c5c28619e42334cd745
5
5
  SHA512:
6
- metadata.gz: b5e32edc6bc22ba580e7c6d7d42a73982803080e9a9782326cb7b8796aa62ad6b75bccb1e6607879f0d3e5a5c4db8e5597d8407b76014f08f3945d1d8ad0097a
7
- data.tar.gz: b8fe0f9419061295f830ed12ae9c8ea089a966686388cff580ddb6e1f7cd8c17a04928f9af41083019a5a11e8cccce25af404959db30a730a2ade2359a7e07ef
6
+ metadata.gz: 489b813f1bb2d7d97f87a60024b0665761571c4227e4fab6c733dcdb62b6ee98760473202c9154eb39a4b544663f759e4da6e70603d483e9f2ec2a64363cd4e1
7
+ data.tar.gz: 05b232d7d67120e0983e60855c928beac6e91271fafc87586da7cc7543128fe326be04d126154ac7e0b0c0b249bf41ca90ab902f79f4a5fbf00cad498061f7e7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.62 2021-07-21
2
+
3
+ - Add `runqueue_size` to backend stats
4
+
1
5
  ## 0.61 2021-07-20
2
6
 
3
7
  - Add more statistics, move stats to `Backend#stats`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polyphony (0.61)
4
+ polyphony (0.62)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -112,22 +112,6 @@ inline void backend_trace(struct Backend_base *base, int argc, VALUE *argv) {
112
112
  rb_funcallv(base->trace_proc, ID_call, argc, argv);
113
113
  }
114
114
 
115
- inline struct backend_stats backend_base_stats(struct Backend_base *base) {
116
- struct backend_stats stats = {
117
- .runqueue_length = runqueue_len(&base->runqueue),
118
- .runqueue_max_length = runqueue_max_len(&base->runqueue),
119
- .op_count = base->op_count,
120
- .switch_count = base->switch_count,
121
- .poll_count = base->poll_count,
122
- .pending_ops = base->pending_count
123
- };
124
-
125
- base->op_count = 0;
126
- base->switch_count = 0;
127
- base->poll_count = 0;
128
- return stats;
129
- }
130
-
131
115
  #ifdef POLYPHONY_USE_PIDFD_OPEN
132
116
  #ifndef __NR_pidfd_open
133
117
  #define __NR_pidfd_open 434 /* System call # on most architectures */
@@ -312,6 +296,24 @@ inline void backend_run_idle_tasks(struct Backend_base *base) {
312
296
  rb_gc_disable();
313
297
  }
314
298
 
299
+ inline struct backend_stats backend_base_stats(struct Backend_base *base) {
300
+ struct backend_stats stats = {
301
+ .runqueue_size = runqueue_size(&base->runqueue),
302
+ .runqueue_length = runqueue_len(&base->runqueue),
303
+ .runqueue_max_length = runqueue_max_len(&base->runqueue),
304
+ .op_count = base->op_count,
305
+ .switch_count = base->switch_count,
306
+ .poll_count = base->poll_count,
307
+ .pending_ops = base->pending_count
308
+ };
309
+
310
+ base->op_count = 0;
311
+ base->switch_count = 0;
312
+ base->poll_count = 0;
313
+ return stats;
314
+ }
315
+
316
+ VALUE SYM_runqueue_size;
315
317
  VALUE SYM_runqueue_length;
316
318
  VALUE SYM_runqueue_max_length;
317
319
  VALUE SYM_op_count;
@@ -323,6 +325,7 @@ VALUE Backend_stats(VALUE self) {
323
325
  struct backend_stats backend_stats = backend_get_stats(self);
324
326
 
325
327
  VALUE stats = rb_hash_new();
328
+ rb_hash_aset(stats, SYM_runqueue_size, INT2NUM(backend_stats.runqueue_size));
326
329
  rb_hash_aset(stats, SYM_runqueue_length, INT2NUM(backend_stats.runqueue_length));
327
330
  rb_hash_aset(stats, SYM_runqueue_max_length, INT2NUM(backend_stats.runqueue_max_length));
328
331
  rb_hash_aset(stats, SYM_op_count, INT2NUM(backend_stats.op_count));
@@ -334,13 +337,15 @@ VALUE Backend_stats(VALUE self) {
334
337
  }
335
338
 
336
339
  void backend_setup_stats_symbols() {
337
- SYM_runqueue_length = ID2SYM(rb_intern("runqueue_length"));
340
+ SYM_runqueue_size = ID2SYM(rb_intern("runqueue_size"));
341
+ SYM_runqueue_length = ID2SYM(rb_intern("runqueue_length"));
338
342
  SYM_runqueue_max_length = ID2SYM(rb_intern("runqueue_max_length"));
339
- SYM_op_count = ID2SYM(rb_intern("op_count"));
340
- SYM_switch_count = ID2SYM(rb_intern("switch_count"));
341
- SYM_poll_count = ID2SYM(rb_intern("poll_count"));
342
- SYM_pending_ops = ID2SYM(rb_intern("pending_ops"));
343
+ SYM_op_count = ID2SYM(rb_intern("op_count"));
344
+ SYM_switch_count = ID2SYM(rb_intern("switch_count"));
345
+ SYM_poll_count = ID2SYM(rb_intern("poll_count"));
346
+ SYM_pending_ops = ID2SYM(rb_intern("pending_ops"));
343
347
 
348
+ rb_global_variable(&SYM_runqueue_size);
344
349
  rb_global_variable(&SYM_runqueue_length);
345
350
  rb_global_variable(&SYM_runqueue_max_length);
346
351
  rb_global_variable(&SYM_op_count);
@@ -6,6 +6,7 @@
6
6
  #include "runqueue.h"
7
7
 
8
8
  struct backend_stats {
9
+ unsigned int runqueue_size;
9
10
  unsigned int runqueue_length;
10
11
  unsigned int runqueue_max_length;
11
12
  unsigned int op_count;
@@ -44,6 +44,10 @@ inline void runqueue_clear(runqueue_t *runqueue) {
44
44
  runqueue_ring_buffer_clear(&runqueue->entries);
45
45
  }
46
46
 
47
+ inline long runqueue_size(runqueue_t *runqueue) {
48
+ return runqueue->entries.size;
49
+ }
50
+
47
51
  inline long runqueue_len(runqueue_t *runqueue) {
48
52
  return runqueue->entries.count;
49
53
  }
@@ -19,6 +19,7 @@ runqueue_entry runqueue_shift(runqueue_t *runqueue);
19
19
  void runqueue_delete(runqueue_t *runqueue, VALUE fiber);
20
20
  int runqueue_index_of(runqueue_t *runqueue, VALUE fiber);
21
21
  void runqueue_clear(runqueue_t *runqueue);
22
+ long runqueue_size(runqueue_t *runqueue);
22
23
  long runqueue_len(runqueue_t *runqueue);
23
24
  long runqueue_max_len(runqueue_t *runqueue);
24
25
  int runqueue_empty_p(runqueue_t *runqueue);
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Polyphony
4
- VERSION = '0.61'
4
+ VERSION = '0.62'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyphony
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.61'
4
+ version: '0.62'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-20 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler