Skip to content

Commit 95ecc10

Browse files
committed
[UR] fix latency tracker build
1 parent b2f23ef commit 95ecc10

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

devops/scripts/benchmarks/benches/compute.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,16 @@ def run(self, env_vars, run_unitrace: bool = False) -> list[Result]:
387387
)
388388
return ret
389389

390+
def calc_stddev(self, mean, percent_str):
391+
try:
392+
cleaned = percent_str.strip().strip('%')
393+
if cleaned and cleaned.replace('.', '', 1).isdigit():
394+
percent = float(cleaned) / 100.0
395+
return mean * percent
396+
except (ValueError, TypeError):
397+
pass
398+
return 0.0
399+
390400
def parse_output(self, output):
391401
csv_file = io.StringIO(output)
392402
reader = csv.reader(csv_file)
@@ -401,7 +411,7 @@ def parse_output(self, output):
401411
mean = float(data_row[1])
402412
median = float(data_row[2])
403413
# compute benchmarks report stddev as %
404-
stddev = mean * (float(data_row[3].strip("%")) / 100.0)
414+
stddev = self.calc_stddev(mean, data_row[3])
405415
unit = data_row[7]
406416
results.append((label, median, stddev, unit))
407417
except (ValueError, IndexError) as e:

unified-runtime/source/common/latency_tracker.hpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,24 @@ class latency_printer {
9494
for (auto &[name, histogram] : values) {
9595
auto value = getValues(histogram.get());
9696
auto f = groupDigits<int64_t>;
97-
logger.log(UR_LOGGER_LEVEL_INFO,
98-
"{},{},{},{},{},{},{},{},{},{},{},{},{},{},ns", name,
99-
f(value.mean), f(value.percentileValues[0]),
100-
f(value.percentileValues[1]), f(value.percentileValues[2]),
101-
f(value.percentileValues[3]), f(value.percentileValues[4]),
102-
f(value.percentileValues[5]), f(value.percentileValues[6]),
103-
f(value.count), f(value.count * value.mean), f(value.min),
104-
f(value.max), value.stddev);
97+
UR_LOG_L(logger, INFO, "{},{},{},{},{},{},{},{},{},{},{},{},{},{},ns",
98+
name, f(value.mean), f(value.percentileValues[0]),
99+
f(value.percentileValues[1]), f(value.percentileValues[2]),
100+
f(value.percentileValues[3]), f(value.percentileValues[4]),
101+
f(value.percentileValues[5]), f(value.percentileValues[6]),
102+
f(value.count), f(value.count * value.mean), f(value.min),
103+
f(value.max), value.stddev);
105104
}
106105
}
107106

108107
private:
109108
inline void printHeader() {
110-
logger.log(UR_LOGGER_LEVEL_INFO, "Latency histogram:");
111-
logger.log(UR_LOGGER_LEVEL_INFO,
112-
"name,mean,p{},p{},p{},p{},p{},p{}"
113-
",p{},count,sum,min,max,stdev,unit",
114-
percentiles[0], percentiles[1], percentiles[2], percentiles[3],
115-
percentiles[4], percentiles[5], percentiles[6]);
109+
UR_LOG_L(logger, INFO, "Latency histogram:");
110+
UR_LOG_L(logger, INFO,
111+
"name,mean,p{},p{},p{},p{},p{},p{}"
112+
",p{},count,sum,min,max,stdev,unit",
113+
percentiles[0], percentiles[1], percentiles[2], percentiles[3],
114+
percentiles[4], percentiles[5], percentiles[6]);
116115
}
117116

118117
std::map<std::string, histogram_ptr> values;

0 commit comments

Comments
 (0)