From: Amos Jeffries Date: Thu, 11 Nov 2021 21:38:31 +0000 (+0000) Subject: Remove CPU profiler mechanism (#931) X-Git-Tag: SQUID_6_0_1~269 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=316fd8664590769ad3aa9b1ea38e14c38ebfa479;p=thirdparty%2Fsquid.git Remove CPU profiler mechanism (#931) The old CPU profiler has not been updated in many years. As a result, the statistics provided are deceptively incomplete and not sufficient for their intended purpose of profiling Squids CPU usage. External tools such as oprofile do a better job despite their differences and some limitations. --- diff --git a/acinclude/os-deps.m4 b/acinclude/os-deps.m4 index 0baf42bc3b..3b2e702c6c 100644 --- a/acinclude/os-deps.m4 +++ b/acinclude/os-deps.m4 @@ -785,33 +785,6 @@ AC_DEFUN([SQUID_CHECK_SETRESUID_WORKS],[ ) ]) -dnl check that we have functional CPU clock access for the profiler -dnl sets squid_cv_profiler_works to "yes" or "no" - -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 -#if defined(__GNUC__) && ( defined(__i386) || defined(__i386__) ) -// okay -#elif defined(__GNUC__) && ( defined(__x86_64) || defined(__x86_64__) ) -// okay -#elif defined(__GNUC__) && defined(__alpha) -// 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 - ]])],[ - squid_cv_cpu_profiler_works=yes],[ - squid_cv_cpu_profiler_works=no]) - ) -]) - dnl check whether recv takes a char* or void* as a second argument AC_DEFUN([SQUID_CHECK_RECV_ARG_TYPE],[ AC_CACHE_CHECK([whether recv takes a pointer to void or char as second argument], diff --git a/compat/xalloc.cc b/compat/xalloc.cc index 0fa94f9f79..e94caaf4c3 100644 --- a/compat/xalloc.cc +++ b/compat/xalloc.cc @@ -8,7 +8,6 @@ #include "squid.h" #include "compat/xalloc.h" -#include "profiler/Profiler.h" #if XMALLOC_STATISTICS #define XMS_DBG_MAXSIZE (1024*1024) @@ -71,17 +70,13 @@ malloc_statistics(void (*func) (int, int, int, void *), void *data) void * xcalloc(size_t n, size_t sz) { - PROF_start(xcalloc); - if (n < 1) n = 1; if (sz < 1) sz = 1; - PROF_start(calloc); void *p = calloc(n, sz); - PROF_stop(calloc); if (p == NULL) { if (failure_notify) { @@ -98,21 +93,16 @@ xcalloc(size_t n, size_t sz) malloc_stat(sz * n); #endif - PROF_stop(xcalloc); return p; } void * xmalloc(size_t sz) { - PROF_start(xmalloc); - if (sz < 1) sz = 1; - PROF_start(malloc); void *p = malloc(sz); - PROF_stop(malloc); if (p == NULL) { if (failure_notify) { @@ -129,21 +119,16 @@ xmalloc(size_t sz) malloc_stat(sz); #endif - PROF_stop(xmalloc); return (p); } void * xrealloc(void *s, size_t sz) { - PROF_start(xrealloc); - if (sz < 1) sz = 1; - PROF_start(realloc); void *p= realloc(s, sz); - PROF_stop(realloc); if (p == NULL) { if (failure_notify) { @@ -161,7 +146,6 @@ xrealloc(void *s, size_t sz) malloc_stat(sz); #endif - PROF_stop(xrealloc); return (p); } @@ -170,10 +154,6 @@ free_const(const void *s_const) { void *s = const_cast(s_const); - PROF_start(free_const); - PROF_start(free); free(s); - PROF_stop(free); - PROF_stop(free_const); } diff --git a/configure.ac b/configure.ac index 97114ae64e..59e0775e9d 100644 --- a/configure.ac +++ b/configure.ac @@ -2636,36 +2636,6 @@ SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no}, [Print stack traces on fatal errors]) AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces]) - -# CPU Profiling options handling -AC_ARG_ENABLE(cpu-profiling, - AS_HELP_STRING([--enable-cpu-profiling], - [Enable instrumentation to try and understand how CPU power - is spent by squid, by enabling specific probes in selected - functions. - New probes can only be added by modifying the source code. - It is meant to help developers in optimizing performance - of Squid internal functions. - If you are not developer you should not enable this, - as it slows squid down somewhat. - See lib/Profiler.c for more details.]), [ -SQUID_YESNO([$enableval], - [unrecognized argument to --enable-cpu-profiling: $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.]) - fi -fi -SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no}, - [Define to enable CPU profiling within Squid]) -AM_CONDITIONAL(ENABLE_XPROF_STATS, - test "x$enable_cpu_profiling" = "xyes") -AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling]) - # Enable X-Accelerator-Vary for Vary support within an accelerator setup AC_ARG_ENABLE(x-accelerator-vary, AS_HELP_STRING([--enable-x-accelerator-vary], @@ -3673,7 +3643,6 @@ AC_CONFIG_FILES([ lib/libTrie/Makefile lib/libTrie/test/Makefile lib/ntlmauth/Makefile - lib/profiler/Makefile lib/rfcnb/Makefile lib/smblib/Makefile lib/snmplib/Makefile diff --git a/doc/release-notes/release-6.sgml b/doc/release-notes/release-6.sgml index 6eda43731d..25b1bd2a47 100644 --- a/doc/release-notes/release-6.sgml +++ b/doc/release-notes/release-6.sgml @@ -119,7 +119,9 @@ This section gives an account of those changes in three categories: Removed options