1 #ifndef __UTILS_MONO_TIME_H__
2 #define __UTILS_MONO_TIME_H__
4 #include <mono/utils/mono-compiler.h>
11 /* Returns the number of milliseconds from boot time: this should be monotonic
13 * Prefer to use mono_msec_ticks for elapsed time calculation. */
14 gint64
mono_msec_boottime (void);
16 /* Returns the number of milliseconds ticks from unspecified time: this should be monotonic */
17 gint64
mono_msec_ticks (void);
19 /* Returns the number of 100ns ticks from unspecified time: this should be monotonic */
20 gint64
mono_100ns_ticks (void);
22 /* Returns the number of 100ns ticks since 1/1/1601, UTC timezone */
23 gint64
mono_100ns_datetime (void);
26 gint64
mono_100ns_datetime_from_timeval (struct timeval tv
);
29 /* Stopwatch class for internal runtime use */
35 mono_stopwatch_start (MonoStopwatch
*w
)
37 w
->start
= mono_100ns_ticks ();
42 mono_stopwatch_stop (MonoStopwatch
*w
)
44 w
->stop
= mono_100ns_ticks ();
48 mono_stopwatch_elapsed (MonoStopwatch
*w
)
50 return (w
->stop
- w
->start
) / 10;
54 mono_stopwatch_elapsed_ms (MonoStopwatch
*w
)
56 return (mono_stopwatch_elapsed (w
) + 500) / 1000;
59 #endif /* __UTILS_MONO_TIME_H__ */