]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - lib/profiler/Profiler.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / lib / profiler / Profiler.cc
index a608ae888eea24051dad8dcf855cbec1e6a8360d..26783032ac2232d68d83cebfffb455d8519af927 100644 (file)
@@ -1,37 +1,13 @@
 /*
- * $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-2020 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
@@ -136,12 +109,11 @@ TimersArray *xprof_Timers = NULL;
 
 /* 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;
 };
@@ -161,7 +133,7 @@ xprof_update(xprof_stats_data * head)
     if (head->worst < head->delta)
         head->worst = head->delta;
     head->summ += head->delta;
-    head->count++;
+    ++head->count;
 }
 
 static xprof_stats_data *xp_UNACCOUNTED;
@@ -209,7 +181,7 @@ xprof_start(xprof_type type, const char *timer)
     cstack[cstack_head].accum = 0;
     cstack[cstack_head].timer = type;
     cstack[cstack_head].name = timer;
-    cstack_head++;
+    ++cstack_head;
     assert(cstack_head < MAXSTACKDEPTH);
 
 }
@@ -219,7 +191,7 @@ xprof_stop(xprof_type type, const char *timer)
 {
     hrtime_t tt = get_tick();
     assert(cstack_head > 0);
-    cstack_head--;
+    --cstack_head;
     assert(cstack[cstack_head].timer == type);
 
     /* Record timer details */
@@ -241,3 +213,4 @@ xprof_stop(xprof_type type, const char *timer)
 }
 
 #endif /* USE_XPROF_STATS */
+