Skip to content

Commit e2d37b6

Browse files
author
Tobias Oberstein
committed
Merge pull request #1 from jchampio/master
Reported test duration is incorrect on some platforms
2 parents a3b431f + ac7233b commit e2d37b6

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

analyze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def analyze(res):
129129
print "Aggregate results (WebSocket Opening+Closing Handshake)"
130130
print
131131
#print " Duration: %9d ms" % (float(res.duration) / 1000.)
132-
print " Duration: %9.1f s" % round(duration_ms, 1)
132+
print " Duration: %9.1f ms" % round(duration_ms, 1)
133133
print " Total: %9d" % res.total
134134
print " Success: %9d" % res.success
135135
print " Fail: %9d" % res.fail
@@ -173,4 +173,4 @@ def printResults(files):
173173
# item.failed boolean False
174174
# item end_map None
175175

176-
# prefix, event, value
176+
# prefix, event, value

wsperf.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ class handshake_test {
204204
}
205205

206206
void test_complete() {
207+
using std::chrono::nanoseconds;
208+
207209
m_test_end = std::chrono::high_resolution_clock::now();
208210
m_test_end_wallclock = std::chrono::system_clock::now();
209211

@@ -212,8 +214,10 @@ class handshake_test {
212214

213215
logfile << "{\"total_duration\":"
214216
<< std::chrono::duration_cast<dur_type>(m_test_end-m_test_start).count()
215-
<< ",\"started\":" << m_test_start_wallclock.time_since_epoch().count()
216-
<< ",\"ended\":" << m_test_end_wallclock.time_since_epoch().count()
217+
<< ",\"started\":"
218+
<< std::chrono::duration_cast<nanoseconds>(m_test_start_wallclock.time_since_epoch()).count()
219+
<< ",\"ended\":"
220+
<< std::chrono::duration_cast<nanoseconds>(m_test_end_wallclock.time_since_epoch()).count()
217221
<< ",\"handshake_throttle_count\":" << m_high_water_mark_count
218222
<< ",\"handshake_resume_count\":" << m_low_water_mark_count
219223
<< ",\"connection_stats\":[";

0 commit comments

Comments
 (0)