Dynamic Load Balance 3.6.1+32-59d1
mytime.h
Go to the documentation of this file.
1/*********************************************************************************/
2/* Copyright 2009-2021 Barcelona Supercomputing Center */
3/* */
4/* This file is part of the DLB library. */
5/* */
6/* DLB is free software: you can redistribute it and/or modify */
7/* it under the terms of the GNU Lesser General Public License as published by */
8/* the Free Software Foundation, either version 3 of the License, or */
9/* (at your option) any later version. */
10/* */
11/* DLB is distributed in the hope that it will be useful, */
12/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14/* GNU Lesser General Public License for more details. */
15/* */
16/* You should have received a copy of the GNU Lesser General Public License */
17/* along with DLB. If not, see <https://www.gnu.org/licenses/>. */
18/*********************************************************************************/
19
20#ifndef MYTIME_H
21#define MYTIME_H
22
23#include <time.h> // for timespec: sec + nsec
24#include <sys/time.h> // for timeval: sec + usec
25#include <inttypes.h>
26
27void get_time( struct timespec *t );
28void get_time_coarse( struct timespec *t );
29void get_time_real( struct timespec *t );
30int64_t get_time_in_ns(void);
31int diff_time( struct timespec init, struct timespec end, struct timespec* diff );
32void add_time( struct timespec t1, struct timespec t2, struct timespec* sum );
33void mult_time( struct timespec t1, int factor, struct timespec* prod );
34void diff_time_mult(struct timespec* time, int mult_factor, struct timespec * result);
35
36void reset( struct timespec *t1 );
37double to_secs( struct timespec t1 );
38int64_t to_nsecs( const struct timespec *ts );
39double nsecs_to_secs( int64_t nsecs );
40int64_t timeval_diff( const struct timeval *init, const struct timeval *end );
41int64_t timespec_diff( const struct timespec *start, const struct timespec *finish );
42void add_tv_to_ts( const struct timeval *t1, const struct timeval *t2, struct timespec *res );
43void ns_to_human( char *buf, size_t size, int64_t ns );
44
45void timer_init(void);
46void *timer_register(const char *key);
47void timer_start(void *handler);
48void timer_stop(void *handler);
49void timer_finalize(void);
50
51
52char* get_iso_8601_string(struct tm *tm_info);
53
54#endif /* MYTIME_H */
char * get_iso_8601_string(struct tm *tm_info)
Definition: mytime.c:254
void ns_to_human(char *buf, size_t size, int64_t ns)
Definition: mytime.c:146
void add_tv_to_ts(const struct timeval *t1, const struct timeval *t2, struct timespec *res)
Definition: mytime.c:134
void get_time(struct timespec *t)
Definition: mytime.c:32
int diff_time(struct timespec init, struct timespec end, struct timespec *diff)
Definition: mytime.c:56
void mult_time(struct timespec t1, int factor, struct timespec *prod)
Definition: mytime.c:87
double nsecs_to_secs(int64_t nsecs)
Definition: mytime.c:118
void reset(struct timespec *t1)
Definition: mytime.c:105
void * timer_register(const char *key)
Definition: mytime.c:189
void timer_start(void *handler)
Definition: mytime.c:217
void add_time(struct timespec t1, struct timespec t2, struct timespec *sum)
Definition: mytime.c:76
void timer_init(void)
Definition: mytime.c:186
int64_t timespec_diff(const struct timespec *start, const struct timespec *finish)
Definition: mytime.c:129
void timer_stop(void *handler)
Definition: mytime.c:223
void diff_time_mult(struct timespec *time, int mult_factor, struct timespec *result)
Definition: mytime.c:98
int64_t get_time_in_ns(void)
Definition: mytime.c:50
void get_time_coarse(struct timespec *t)
Definition: mytime.c:36
int64_t to_nsecs(const struct timespec *ts)
Definition: mytime.c:114
void get_time_real(struct timespec *t)
Definition: mytime.c:44
void timer_finalize(void)
Definition: mytime.c:232
int64_t timeval_diff(const struct timeval *init, const struct timeval *end)
Definition: mytime.c:123
double to_secs(struct timespec t1)
Definition: mytime.c:110