-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zero maps from Python #142
Comments
This actually already works! Python conveniently implements a bunch of functions (like clear) when one inherits from MutableMapping. I will add a test case to capture this. |
drzaeus77
pushed a commit
that referenced
this issue
Aug 22, 2015
Fixes: #142 Signed-off-by: Brenden Blanco <[email protected]>
I couldn't get clear() to work. Maybe I'm using it incorrectly? From pidpersec: # output
while (1):
try:
sleep(1)
except KeyboardInterrupt:
pass; exit()
print("%s: PIDs/sec: %d" % (strftime("%H:%M:%S"),
b["stats"][S_COUNT].value))
b["stats"].clear() # ./pidpersec
Tracing... Ctrl-C to end.
19:29:33: PIDs/sec: 0
19:29:34: PIDs/sec: 0
19:29:35: PIDs/sec: 0
19:29:36: PIDs/sec: 0
19:29:37: PIDs/sec: 17
19:29:38: PIDs/sec: 17
19:29:39: PIDs/sec: 18
19:29:40: PIDs/sec: 19
19:29:41: PIDs/sec: 19
19:29:42: PIDs/sec: 19
19:29:43: PIDs/sec: 19 |
this now works, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using maps to store per-interval sums, it would be handy if we could clear the maps from Python, otherwise it's necessary to store the prior values and then calculate the delta each interval. Of course, Python could pretend to clear the maps and keep its own tally of what to expose.
The text was updated successfully, but these errors were encountered: