Linux Perf
time-utils.c File Reference
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <linux/time64.h>
#include <time.h>
#include <errno.h>
#include <inttypes.h>
#include <math.h>
#include "perf.h"
#include "debug.h"
#include "time-utils.h"
Include dependency graph for time-utils.c:

Go to the source code of this file.

Typedefs

typedef int(* time_pecent_split) (char *, struct perf_time_interval *, u64 start, u64 end)
 

Functions

int parse_nsec_time (const char *str, u64 *ptime)
 
static int parse_timestr_sec_nsec (struct perf_time_interval *ptime, char *start_str, char *end_str)
 
static int split_start_end (char **start, char **end, const char *ostr, char ch)
 
int perf_time__parse_str (struct perf_time_interval *ptime, const char *ostr)
 
static int parse_percent (double *pcnt, char *str)
 
static int percent_slash_split (char *str, struct perf_time_interval *ptime, u64 start, u64 end)
 
static int percent_dash_split (char *str, struct perf_time_interval *ptime, u64 start, u64 end)
 
static int percent_comma_split (struct perf_time_interval *ptime_buf, int num, const char *ostr, u64 start, u64 end, time_pecent_split func)
 
static int one_percent_convert (struct perf_time_interval *ptime_buf, const char *ostr, u64 start, u64 end, char *c)
 
int perf_time__percent_parse_str (struct perf_time_interval *ptime_buf, int num, const char *ostr, u64 start, u64 end)
 
struct perf_time_intervalperf_time__range_alloc (const char *ostr, int *size)
 
bool perf_time__skip_sample (struct perf_time_interval *ptime, u64 timestamp)
 
bool perf_time__ranges_skip_sample (struct perf_time_interval *ptime_buf, int num, u64 timestamp)
 
int timestamp__scnprintf_usec (u64 timestamp, char *buf, size_t sz)
 
int fetch_current_timestamp (char *buf, size_t sz)
 

Typedef Documentation

◆ time_pecent_split

typedef int(* time_pecent_split) (char *, struct perf_time_interval *, u64 start, u64 end)

Definition at line 216 of file time-utils.c.

Function Documentation

◆ fetch_current_timestamp()

int fetch_current_timestamp ( char *  buf,
size_t  sz 
)

Definition at line 407 of file time-utils.c.

◆ one_percent_convert()

static int one_percent_convert ( struct perf_time_interval ptime_buf,
const char *  ostr,
u64  start,
u64  end,
char *  c 
)
static

Definition at line 264 of file time-utils.c.

Here is the call graph for this function:

◆ parse_nsec_time()

int parse_nsec_time ( const char *  str,
u64 *  ptime 
)

Definition at line 15 of file time-utils.c.

◆ parse_percent()

static int parse_percent ( double *  pcnt,
char *  str 
)
static

Definition at line 117 of file time-utils.c.

◆ parse_timestr_sec_nsec()

static int parse_timestr_sec_nsec ( struct perf_time_interval ptime,
char *  start_str,
char *  end_str 
)
static

Definition at line 48 of file time-utils.c.

Here is the call graph for this function:

◆ percent_comma_split()

static int percent_comma_split ( struct perf_time_interval ptime_buf,
int  num,
const char *  ostr,
u64  start,
u64  end,
time_pecent_split  func 
)
static

Definition at line 219 of file time-utils.c.

Here is the call graph for this function:

◆ percent_dash_split()

static int percent_dash_split ( char *  str,
struct perf_time_interval ptime,
u64  start,
u64  end 
)
static

Definition at line 180 of file time-utils.c.

Here is the call graph for this function:

◆ percent_slash_split()

static int percent_slash_split ( char *  str,
struct perf_time_interval ptime,
u64  start,
u64  end 
)
static

Definition at line 136 of file time-utils.c.

Here is the call graph for this function:

◆ perf_time__parse_str()

int perf_time__parse_str ( struct perf_time_interval ptime,
const char *  ostr 
)

Definition at line 91 of file time-utils.c.

Here is the call graph for this function:

◆ perf_time__percent_parse_str()

int perf_time__percent_parse_str ( struct perf_time_interval ptime_buf,
int  num,
const char *  ostr,
u64  start,
u64  end 
)

Definition at line 295 of file time-utils.c.

Here is the call graph for this function:

◆ perf_time__range_alloc()

struct perf_time_interval* perf_time__range_alloc ( const char *  ostr,
int *  size 
)

Definition at line 328 of file time-utils.c.

◆ perf_time__ranges_skip_sample()

bool perf_time__ranges_skip_sample ( struct perf_time_interval ptime_buf,
int  num,
u64  timestamp 
)

Definition at line 371 of file time-utils.c.

Here is the call graph for this function:

◆ perf_time__skip_sample()

bool perf_time__skip_sample ( struct perf_time_interval ptime,
u64  timestamp 
)

Definition at line 356 of file time-utils.c.

◆ split_start_end()

static int split_start_end ( char **  start,
char **  end,
const char *  ostr,
char  ch 
)
static

Definition at line 64 of file time-utils.c.

Here is the call graph for this function:

◆ timestamp__scnprintf_usec()

int timestamp__scnprintf_usec ( u64  timestamp,
char *  buf,
size_t  sz 
)

Definition at line 399 of file time-utils.c.