This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new af352c551d Plugin: change system_stats to use std::chrono instead of 
ink_hrtime. (#9612)
af352c551d is described below

commit af352c551d8b1fccfdfeff56e9ed710fdf5ddd85
Author: Alan M. Carroll <[email protected]>
AuthorDate: Sun Apr 16 01:19:09 2023 -0500

    Plugin: change system_stats to use std::chrono instead of ink_hrtime. 
(#9612)
---
 plugins/experimental/system_stats/system_stats.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plugins/experimental/system_stats/system_stats.cc 
b/plugins/experimental/system_stats/system_stats.cc
index cc77628154..8f5ea9ff74 100644
--- a/plugins/experimental/system_stats/system_stats.cc
+++ b/plugins/experimental/system_stats/system_stats.cc
@@ -43,6 +43,7 @@
 #include <dirent.h>
 #include <stdint.h>
 #include <sys/types.h>
+#include <chrono>
 
 #include "ink_autoconf.h"
 
@@ -51,7 +52,6 @@
 #endif
 
 #include <limits.h>
-#include "tscore/ink_hrtime.h"
 
 #define PLUGIN_NAME "system_stats"
 #define DEBUG_TAG   PLUGIN_NAME
@@ -276,7 +276,9 @@ getStats(TSMutex stat_creation_mutex)
 
   sysinfo(&info);
 
-  statSet(TIMESTAMP, ink_hrtime_to_msec(ink_get_hrtime_internal()), 
stat_creation_mutex);
+  statSet(TIMESTAMP,
+          
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(),
+          stat_creation_mutex);
   statSet(LOAD_AVG_ONE_MIN, info.loads[0], stat_creation_mutex);
   statSet(LOAD_AVG_FIVE_MIN, info.loads[1], stat_creation_mutex);
   statSet(LOAD_AVG_FIFTEEN_MIN, info.loads[2], stat_creation_mutex);

Reply via email to