/* make sure end time is after start time if it was given */ if (rc == 0 && ptime->end && ptime->end < ptime->start) return -EINVAL;
pr_debug("start time %" PRIu64 ", ", ptime->start);
pr_debug("end time %" PRIu64 "\n", ptime->end);
return rc;
}
staticint perf_time__parse_strs(struct perf_time_interval *ptime, constchar *ostr, int size)
{ constchar *cp; char *str, *arg, *p; int i, num = 0, rc = 0;
/* Count the commas */ for (cp = ostr; *cp; cp++)
num += !!(*cp == ',');
if (!num) return -EINVAL;
BUG_ON(num > size);
str = strdup(ostr); if (!str) return -ENOMEM;
/* Split the string and parse each piece, except the last */ for (i = 0, p = str; i < num - 1; i++) {
arg = p; /* Find next comma, there must be one */
p = skip_spaces(strchr(p, ',') + 1); /* Skip the value, must not contain space or comma */ while (*p && !isspace(*p)) { if (*p++ == ',') {
rc = -EINVAL; goto out;
}
} /* Split and parse */ if (*p)
*p++ = 0;
rc = perf_time__parse_str(ptime + i, arg); if (rc < 0) goto out;
}
/* Parse the last piece */
rc = perf_time__parse_str(ptime + i, p); if (rc < 0) goto out;
/* Check there is no overlap */ for (i = 0; i < num - 1; i++) { if (ptime[i].end >= ptime[i + 1].start) {
rc = -EINVAL; goto out;
}
}
bool perf_time__skip_sample(struct perf_time_interval *ptime, u64 timestamp)
{ /* if time is not set don't drop sample */ if (timestamp == 0) returnfalse;
/* otherwise compare sample time to time window */ if ((ptime->start && timestamp < ptime->start) ||
(ptime->end && timestamp > ptime->end)) { returntrue;
}
returnfalse;
}
bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf, int num, u64 timestamp)
{ struct perf_time_interval *ptime; int i;
int perf_time__parse_for_ranges_reltime(constchar *time_str, struct perf_session *session, struct perf_time_interval **ranges, int *range_size, int *range_num, bool reltime)
{ bool has_percent = strchr(time_str, '%'); struct perf_time_interval *ptime_range; int size, num, ret = -EINVAL;
ptime_range = perf_time__range_alloc(time_str, &size); if (!ptime_range) return -ENOMEM;
if (has_percent || reltime) { if (session->evlist->first_sample_time == 0 &&
session->evlist->last_sample_time == 0) {
pr_err("HINT: no first/last sample time found in perf data.\n" "Please use latest perf binary to execute 'perf record'\n" "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n"); goto error;
}
}
if (has_percent) {
num = perf_time__percent_parse_str(
ptime_range, size,
time_str,
session->evlist->first_sample_time,
session->evlist->last_sample_time);
} else {
num = perf_time__parse_strs(ptime_range, time_str, size);
}
if (num < 0) goto error_invalid;
if (reltime) { int i;
for (i = 0; i < num; i++) {
ptime_range[i].start += session->evlist->first_sample_time;
ptime_range[i].end += session->evlist->first_sample_time;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.