-
/*
- * $Id$
- *
- * DEBUG: section 81 CPU Profiling Routines
- * AUTHOR: Andres Kroonmaa
- *
- * SQUID Internet Object Cache http://squid.nlanr.net/Squid/
- * ----------------------------------------------------------
- *
- * Squid is the result of efforts by numerous individuals from the
- * Internet community. Development is led by Duane Wessels of the
- * National Laboratory for Applied Network Research and funded by the
- * National Science Foundation. Squid is Copyrighted (C) 1998 by
- * the Regents of the University of California. Please see the
- * COPYRIGHT file for full details. Squid incorporates software
- * developed and/or copyrighted by other sources. Please see the
- * CREDITS file for full details.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
*
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
-#include "squid-old.h"
+/* DEBUG: section 81 CPU Profiling Routines */
+
+#include "squid.h"
#if USE_XPROF_STATS
#include "event.h"
#include "mgr/Registration.h"
+#include "profiler/Profiler.h"
#include "SquidMath.h"
#include "Store.h"
}
static int
-xprof_comp(xprof_stats_node ** ii, xprof_stats_node ** jj)
+xprof_comp(const void *A, const void *B)
{
- if ((*ii)->hist.summ < (*jj)->hist.summ)
+ const xprof_stats_node *ii = *(static_cast<const xprof_stats_node * const *>(A));
+ const xprof_stats_node *jj = *(static_cast<const xprof_stats_node * const *>(B));
+
+ if (ii->hist.summ < jj->hist.summ)
return (1);
- if ((*ii)->hist.summ > (*jj)->hist.summ)
+ if (ii->hist.summ > jj->hist.summ)
return (-1);
return (0);
static void
xprof_sorthist(TimersArray * xprof_list)
{
- for (int i = 0; i < XPROF_LAST; i++) {
+ for (int i = 0; i < XPROF_LAST; ++i) {
sortlist[i] = xprof_list[i];
}
- qsort(&sortlist[XPROF_PROF_UNACCOUNTED+1], XPROF_LAST - XPROF_PROF_UNACCOUNTED+1, sizeof(xprof_stats_node *), (QS *) xprof_comp);
+ qsort(&sortlist[XPROF_PROF_UNACCOUNTED+1], XPROF_LAST - XPROF_PROF_UNACCOUNTED+1, sizeof(xprof_stats_node *), xprof_comp);
}
static double time_frame;
storeAppendPrintf(sentry,
"Probe Name\t Events\t cumulated time \t best case \t average \t worst case\t Rate / sec \t %% in int\n");
- for (i = 0; i < XPROF_LAST; i++) {
+ for (i = 0; i < XPROF_LAST; ++i) {
if (!hist[i]->name)
continue;
now = get_tick();
- for (i = 0; i < XPROF_LAST; i++) {
+ for (i = 0; i < XPROF_LAST; ++i) {
hist[i]->name = head[i]->name;
hist[i]->accu.summ += head[i]->accu.summ;
- hist[i]->accu.count += head[i]->accu.count; /* accumulate multisec */
+ hist[i]->accu.count += head[i]->accu.count; /* accumulate multisec */
if (!hist[i]->accu.best)
hist[i]->accu.best = head[i]->accu.best;
xprof_Init();
xprof_delta = now - xprof_start_t;
xprof_start_t = now;
- xprof_events++;
+ ++xprof_events;
if (!xprof_average_delta)
xprof_average_delta = xprof_delta;
}
#endif /* USE_XPROF_STATS */
+