]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Profiling: CPU timing implemented for MAC non-x86 (#757)
authorDavid CARLIER <devnexen@gmail.com>
Fri, 15 Jan 2021 15:41:47 +0000 (15:41 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 16 Jan 2021 19:04:29 +0000 (19:04 +0000)
CONTRIBUTORS
acinclude/os-deps.m4
configure.ac
lib/profiler/get_tick.h

index c10a22154363d90d90b3fd18431fb632c05eada6..4a7edc802b8b3f622e64ea1a4bf06a889c2ab67d 100644 (file)
@@ -105,6 +105,7 @@ Thank you!
     Dan Searle <dan@censornet.com>
     Dan Searle <dan.searle@censornet.com>
     Dave Dykstra <dwd@fnal.gov>
+    David Carlier <devnexen@gmail.com>
     David Hill <david.hill@ubisoft.com>
     David Isaacs <david.isaacs@sbhs.nsw.edu.au>
     David J N Begley
index e88ae7b9b79ad26ea280b10a0e508407caa42c2d..a0c4e8cc83ce7a89f002a40d1cfde01633973672 100644 (file)
@@ -792,6 +792,7 @@ AC_DEFUN([SQUID_CHECK_FUNCTIONAL_CPU_PROFILER],[
   AC_CACHE_CHECK([for operational CPU clock access], 
                  squid_cv_cpu_profiler_works,
     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
+#include <ctime>
 #if defined(__GNUC__) && ( defined(__i386) || defined(__i386__) )
 // okay
 #elif defined(__GNUC__) && ( defined(__x86_64) || defined(__x86_64__) )
@@ -800,6 +801,8 @@ AC_DEFUN([SQUID_CHECK_FUNCTIONAL_CPU_PROFILER],[
 // okay
 #elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */
 // okay
+#elif defined(HAVE_CLOCK_GETTIME_NSEC_NP) && defined(CLOCK_MONOTONIC_RAW)
+// okay
 #else
 #error This CPU is unsupported. No profiling available here.
 #endif
index 2396cd74ba92e09c587fdc63114b5e22f9482011..f24a62998f56813a36f2c81a69cc4ecfd299d68a 100644 (file)
@@ -2638,6 +2638,7 @@ SQUID_YESNO([$enableval],
 ])
 # Default OFF. This is a debug feature. Only check and enable if forced ON.
 if test "x$enable_cpu_profiling" = "xyes"; then
+  AC_CHECK_FUNCS(clock_gettime_nsec_np)
   SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
   if test "x$squid_cv_cpu_profiler_works" = "xno"; then
     AC_MSG_ERROR([CPU profiling will not be functional in this build.])
index 8e8189f27df3592653c2e793fafa704ad42262de..f748d2feebbc48a4892ba0ed6b99595f7b8f8ede 100644 (file)
@@ -10,6 +10,7 @@
 #define _PROFILER_GET_TICK_H_
 
 #if USE_XPROF_STATS
+#include <ctime>
 
 /*
  * Ensure that any changes here are synchronised with SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
@@ -67,6 +68,14 @@ get_tick(void)
     return regs;
 }
 
+#elif defined(HAVE_CLOCK_GETTIME_NSEC_NP) && defined(CLOCK_MONOTONIC_RAW)
+
+static inline hrtime_t
+get_tick()
+{
+    return clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
+}
+
 #else
 /* This CPU is unsupported. Short-circuit, no profiling here */
 // #error for configure tests to prevent library construction