Re: [PATCH v3 07/11] perf tools report: Support running scripts for current time range

From: Jiri Olsa
Date: Mon Mar 04 2019 - 09:48:45 EST


On Thu, Feb 28, 2019 at 10:35:46AM -0800, Andi Kleen wrote:

SNIP

> +add_script_opt(struct hist_browser *browser,
> + struct popup_action *act, char **optstr,
> + struct thread *thread, struct symbol *sym)
> +{
> + int n, j;
> + struct hist_entry *he;
> +
> + n = add_script_opt_2(browser, act, optstr, thread, sym, "");
> +
> + he = hist_browser__selected_entry(browser);
> + if (sort_order && strstr(sort_order, "time")) {
> + char tstr[128];
> +
> + optstr++;
> + act++;
> + j = sprintf(tstr, " in ");
> + j += timestamp__scnprintf_usec(he->time, tstr + j,
> + sizeof tstr - j);
> + j += sprintf(tstr + j, "-");
> + timestamp__scnprintf_usec(he->time + symbol_conf.time_quantum,
> + tstr + j,
> + sizeof tstr - j);

no need to put sizeof on extra line

jirka