Skip to content

Commit 23bf0e0

Browse files
authored
[Proton] Add warning in Proton viewer about negative byte values (intel#4495)
1 parent edcc2bc commit 23bf0e0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

third_party/proton/proton/viewer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ def parse(metrics, filename, include, exclude, threshold, depth, format):
187187
# TODO: generalize to support multiple metrics, not just the first one
188188
gf = filter_frames(gf, include, exclude, threshold, metrics[0])
189189
print(gf.tree(metric_column=metrics, expand_name=True, depth=depth, render_header=False))
190+
emitWarnings(gf, metrics)
191+
192+
193+
def emitWarnings(gf, metrics):
194+
if "bytes (inc)" in metrics:
195+
byte_values = gf.dataframe["bytes (inc)"].values
196+
min_byte_value = np.nanmin(byte_values)
197+
if min_byte_value < 0:
198+
print("Warning: Negative byte values detected, this is usually the result of a datatype overflow\n")
190199

191200

192201
def show_metrics(file_name):

0 commit comments

Comments
 (0)