2014-04-24 19:56:31 +00:00
|
|
|
/* time_util.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2017-12-10 03:24:10 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2014-04-24 19:56:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TIME_UTIL_H__
|
|
|
|
#define __TIME_UTIL_H__
|
|
|
|
|
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2016-07-11 22:40:03 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2014-04-24 19:56:31 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
time_t mktime_utc(struct tm *tm);
|
|
|
|
|
2016-04-07 22:31:21 +00:00
|
|
|
/** Fetch the process CPU time.
|
|
|
|
*
|
|
|
|
* Fetch the current process user and system CPU times, convert them to
|
|
|
|
* seconds, and store them in the provided parameters.
|
|
|
|
*
|
2016-08-30 09:12:44 +00:00
|
|
|
* @param user_time Seconds spent in user mode.
|
|
|
|
* @param sys_time Seconds spent in system (kernel) mode.
|
2016-04-07 22:31:21 +00:00
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
2016-08-30 09:12:44 +00:00
|
|
|
void get_resource_usage(double *user_time, double *sys_time);
|
2016-04-07 22:31:21 +00:00
|
|
|
|
2016-07-11 22:40:03 +00:00
|
|
|
/** Print the process CPU time followed by a log message.
|
|
|
|
*
|
|
|
|
* Print the current process user and system CPU times along with the times
|
|
|
|
* elapsed since the times were last reset.
|
|
|
|
*
|
|
|
|
* @param reset_delta Reset the delta times. This will typically be TRUE when
|
|
|
|
* logging the first measurement and FALSE thereafter.
|
|
|
|
* @param format Printf-style format string. Passed to g_string_vprintf.
|
|
|
|
* @param ... Parameters for the format string.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void log_resource_usage(gboolean reset_delta, const char *format, ...);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2014-04-24 19:56:31 +00:00
|
|
|
#endif /* __TIME_UTIL_H__ */
|