From: Andi Kleen <a...@linux.intel.com> When a sample doesn't have a time stamp (e.g. from --no-time), show the beginning of the trace for res samples instead of generating an impossible time range that errors out.
Signed-off-by: Andi Kleen <a...@linux.intel.com> --- tools/perf/ui/browsers/res_sample.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/ui/browsers/res_sample.c b/tools/perf/ui/browsers/res_sample.c index c0dd73176d42..c450a3536f10 100644 --- a/tools/perf/ui/browsers/res_sample.c +++ b/tools/perf/ui/browsers/res_sample.c @@ -60,7 +60,9 @@ int res_sample_browse(struct res_sample *res_samples, int num_res, return -1; r = &res_samples[choice]; - n = timestamp__scnprintf_nsec(r->time - context_len, trange, sizeof trange); + n = timestamp__scnprintf_nsec(r->time > context_len ? + r->time - context_len : r->time, + trange, sizeof trange); trange[n++] = ','; timestamp__scnprintf_nsec(r->time + context_len, trange + n, sizeof trange - n); -- 2.20.1