/*
- * $Id$
- *
- * DEBUG: section 81 CPU Profiling Routines
- * AUTHOR: Andres Kroonmaa, Sep.2000
- *
- * 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.
*/
+/* DEBUG: section 81 CPU Profiling Routines */
+
/**
* CPU Profiling implementation.
*
#if USE_XPROF_STATS
-
-#if HAVE_ASSERT_H
-#include <assert.h>
-#endif
+#include <cassert>
#if HAVE_GNUMALLLOC_H
#include <gnumalloc.h>
#elif HAVE_MALLOC_H
/* Private stuff */
-
/* new stuff */
-#define MAXSTACKDEPTH 512
+#define MAXSTACKDEPTH 512
struct _callstack_entry {
- int timer; /* index into timers array */
+ int timer; /* index into timers array */
const char *name;
hrtime_t start, stop, accum;
};
if (head->worst < head->delta)
head->worst = head->delta;
head->summ += head->delta;
- head->count++;
+ ++head->count;
}
static xprof_stats_data *xp_UNACCOUNTED;
cstack[cstack_head].accum = 0;
cstack[cstack_head].timer = type;
cstack[cstack_head].name = timer;
- cstack_head++;
+ ++cstack_head;
assert(cstack_head < MAXSTACKDEPTH);
}
{
hrtime_t tt = get_tick();
assert(cstack_head > 0);
- cstack_head--;
+ --cstack_head;
assert(cstack[cstack_head].timer == type);
/* Record timer details */
}
#endif /* USE_XPROF_STATS */
+