blob: 70b177d2b98c3b1f3b6c0705d559d2d188b76f2f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
David Ahernfdf9dc42016-11-29 10:15:41 -07002#ifndef _TIME_UTILS_H_
3#define _TIME_UTILS_H_
4
Arnaldo Carvalho de Meloc5e40272017-04-19 16:12:39 -03005#include <stddef.h>
6#include <linux/types.h>
7
David Ahernfdf9dc42016-11-29 10:15:41 -07008struct perf_time_interval {
9 u64 start, end;
10};
11
David Ahernc284d662016-11-29 10:15:42 -070012int parse_nsec_time(const char *str, u64 *ptime);
13
David Ahernfdf9dc42016-11-29 10:15:41 -070014int perf_time__parse_str(struct perf_time_interval *ptime, const char *ostr);
15
Jin Yao13a70f32017-12-08 21:13:43 +080016int perf_time__percent_parse_str(struct perf_time_interval *ptime_buf, int num,
17 const char *ostr, u64 start, u64 end);
18
Jin Yao5a031f82018-01-10 23:00:31 +080019struct perf_time_interval *perf_time__range_alloc(const char *ostr, int *size);
20
David Ahernfdf9dc42016-11-29 10:15:41 -070021bool perf_time__skip_sample(struct perf_time_interval *ptime, u64 timestamp);
22
Jin Yao9a9b8b42017-12-08 21:13:44 +080023bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
24 int num, u64 timestamp);
25
Arnaldo Carvalho de Meloc5e40272017-04-19 16:12:39 -030026int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);
27
28int fetch_current_timestamp(char *buf, size_t sz);
29
David Ahernfdf9dc42016-11-29 10:15:41 -070030#endif