OpenOCD
time_support.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2006 by Dominic Rath *
5  * Dominic.Rath@gmx.de *
6  * *
7  * Copyright (C) 2007,2008 Øyvind Harboe *
8  * oyvind.harboe@zylin.com *
9  * *
10  * Copyright (C) 2008 by Spencer Oliver *
11  * spen@spen-soft.co.uk *
12  ***************************************************************************/
13 
14 #ifndef OPENOCD_HELPER_TIME_SUPPORT_H
15 #define OPENOCD_HELPER_TIME_SUPPORT_H
16 
17 #include <time.h>
18 #include "types.h"
19 
20 #ifdef HAVE_SYS_TIME_H
21 #include <sys/time.h>
22 #endif
23 
25 int64_t timeval_ms(void);
26 
27 struct duration {
28  int64_t start_ms;
29  int64_t elapsed_ms;
30 };
31 
33 int duration_start(struct duration *duration);
36 
38 float duration_elapsed(const struct duration *duration);
40 float duration_kbps(const struct duration *duration, size_t count);
41 
42 #endif /* OPENOCD_HELPER_TIME_SUPPORT_H */
int64_t start_ms
Definition: time_support.h:28
int64_t elapsed_ms
Definition: time_support.h:29
float duration_elapsed(const struct duration *duration)
Definition: time_support.c:46
int duration_measure(struct duration *duration)
Update the duration->elapsed field to finish the duration measurement.
Definition: time_support.c:34
int duration_start(struct duration *duration)
Update the duration->start field to start the duration measurement.
Definition: time_support.c:22
int64_t timeval_ms(void)
float duration_kbps(const struct duration *duration, size_t count)
Definition: time_support.c:51
uint8_t count[4]
Definition: vdebug.c:22