mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
traffic: uniform stats output
The original code is trying to output different data format for tty or file. This is unnecessary and cause confusion while writing script to parse result. The human-readable one is also easy for code to parse. Remove if check for isatty(), just make output the same. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
8084f1838c
commit
68c64c634a
@ -1963,25 +1963,16 @@ def generate_stats(statsdir, timing_file):
|
||||
else:
|
||||
failure_rate = failed / duration
|
||||
|
||||
# print the stats in more human-readable format when stdout is going to the
|
||||
# console (as opposed to being redirected to a file)
|
||||
if sys.stdout.isatty():
|
||||
print("Total conversations: %10d" % conversations)
|
||||
print("Successful operations: %10d (%.3f per second)"
|
||||
% (successful, success_rate))
|
||||
print("Failed operations: %10d (%.3f per second)"
|
||||
% (failed, failure_rate))
|
||||
else:
|
||||
print("(%d, %d, %d, %.3f, %.3f)" %
|
||||
(conversations, successful, failed, success_rate, failure_rate))
|
||||
print("Total conversations: %10d" % conversations)
|
||||
print("Successful operations: %10d (%.3f per second)"
|
||||
% (successful, success_rate))
|
||||
print("Failed operations: %10d (%.3f per second)"
|
||||
% (failed, failure_rate))
|
||||
|
||||
print("Protocol Op Code Description "
|
||||
" Count Failed Mean Median "
|
||||
"95% Range Max")
|
||||
|
||||
if sys.stdout.isatty():
|
||||
print("Protocol Op Code Description "
|
||||
" Count Failed Mean Median "
|
||||
"95% Range Max")
|
||||
else:
|
||||
print("proto\top_code\tdesc\tcount\tfailed\tmean\tmedian\t95%\trange"
|
||||
"\tmax")
|
||||
protocols = sorted(latencies.keys())
|
||||
for protocol in protocols:
|
||||
packet_types = sorted(latencies[protocol], key=opcode_key)
|
||||
|
Loading…
x
Reference in New Issue
Block a user