to end of file.
Also support time percent with multipe time range. Time string is
- 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'. The maximum number of slices is 10.
+ 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.
For example:
- Select the second 10% time slice
+ Select the second 10% time slice:
perf script --time 10%/2
- Select from 0% to 10% time slice
+ Select from 0% to 10% time slice:
perf script --time 0%-10%
- Select the first and second 10% time slices
+ Select the first and second 10% time slices:
perf script --time 10%/1,10%/2
- Select from 0% to 10% and 30% to 40% slices
+ Select from 0% to 10% and 30% to 40% slices:
perf script --time 0%-10%,30%-40%
--max-blocks::
return 0;
}
-#define PTIME_RANGE_MAX 10
-
struct perf_script {
struct perf_tool tool;
struct perf_session *session;
struct thread_map *threads;
int name_width;
const char *time_str;
- struct perf_time_interval ptime_range[PTIME_RANGE_MAX];
+ struct perf_time_interval *ptime_range;
+ int range_size;
int range_num;
};
if (err < 0)
goto out_delete;
+ script.ptime_range = perf_time__range_alloc(script.time_str,
+ &script.range_size);
+ if (!script.ptime_range) {
+ err = -ENOMEM;
+ goto out_delete;
+ }
+
/* needs to be parsed after looking up reference time */
if (perf_time__parse_str(script.ptime_range, script.time_str) != 0) {
if (session->evlist->first_sample_time == 0 &&
}
script.range_num = perf_time__percent_parse_str(
- script.ptime_range, PTIME_RANGE_MAX,
+ script.ptime_range, script.range_size,
script.time_str,
session->evlist->first_sample_time,
session->evlist->last_sample_time);
flush_scripting();
out_delete:
+ zfree(&script.ptime_range);
+
perf_evlist__free_stats(session->evlist);
perf_session__delete(session);