Skip to content

estat issues #22

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

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions bpf/standalone/zil.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from bcc import BPF
from time import sleep, strftime
import argparse
import sys
import os
repo_lib_dir = os.path.dirname(__file__) + "/../../lib/"
Expand All @@ -46,8 +47,19 @@
#include <sys/zil_impl.h>
"""

if len(sys.argv) > 1:
bpf_text += '#define POOL "' + sys.argv[1] + '"'
parser = argparse.ArgumentParser(
description='Collect zil latency statistics.',
usage='estat zil [options]')
parser.add_argument('-c', '--coll', type=int, action='store',
dest='collection_sec',
help='The collection interval in seconds')
parser.add_argument('-p', '--pool', type=str, action='store',
dest='pool',
help='The pool to monitor (default: domain0)')
args = parser.parse_args()

if (args.pool):
bpf_text += '#define POOL "' + str(args.pool) + '"'
else:
bpf_text += '#define POOL "domain0"'

Expand Down Expand Up @@ -276,7 +288,22 @@
BCCHelper.AVERAGE_AGGREGATION, "avg")
alloc_helper.add_key_type("name")

print(" Tracing enabled... Hit Ctrl-C to end.")
if (not args.collection_sec):
print(" Tracing enabled... Hit Ctrl-C to end.")

# Collect data for a collection interval if specified
if (args.collection_sec):
sleep(args.collection_sec)
try:
print("%-16s\n" % strftime("%D - %H:%M:%S %Z"))
latency_helper.printall()
alloc_helper.printall()
exit(0)
except Exception as e:
print(str(e))
exit(0)

# Collect data until keyborad interrupt with output for each second
while (1):
try:
sleep(60)
Expand Down
3 changes: 3 additions & 0 deletions lib/bcchelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ def items_to_string(self, agg_items):
stripped_key = ""
try:
stripped_key = keystr[keystr.index(',')+1:len(keystr)-1]
stripped_key = stripped_key.strip()
if stripped_key[-1:] == ",":
stripped_key = stripped_key[:-1]
except ValueError:
pass

Expand Down