summaryrefslogtreecommitdiff
path: root/wsutil/time_util.h
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-07-11 15:40:03 -0700
committerGerald Combs <gerald@wireshark.org>2016-07-12 15:04:43 +0000
commit479caf15e7f57da098fd94b5f947ac45a6496663 (patch)
treefe87f6ed71aca3e4d117532918ed5ab538a79b09 /wsutil/time_util.h
parent3fe92ffabfa00d981797ef950af6eaa526617b9b (diff)
downloadwireshark-479caf15e7f57da098fd94b5f947ac45a6496663.tar.gz
Add resource usage logging.
Add log_resource_usage, which prints the current and elapsed user and system times. Add a usage example in packet_list_model.cpp. Change-Id: I747161c754a3731e540821715cc9bb10b3dc821d Reviewed-on: https://code.wireshark.org/review/16383 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'wsutil/time_util.h')
-rw-r--r--wsutil/time_util.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/wsutil/time_util.h b/wsutil/time_util.h
index 37c6669b30..9f1367db2d 100644
--- a/wsutil/time_util.h
+++ b/wsutil/time_util.h
@@ -24,9 +24,30 @@
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#include <time.h>
WS_DLL_PUBLIC
time_t mktime_utc(struct tm *tm);
+/** 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 */
+
#endif /* __TIME_UTIL_H__ */