Panda3D

Loading...
Searching...
No Matches
pStatTimer.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pStatTimer.h
10 * @author drose
11 * @date 2000-07-11
12 */
13
14#ifndef PSTATTIMER_H
15#define PSTATTIMER_H
16
17#include "pandabase.h"
18
19#include "pStatCollector.h"
20
21 class Thread;
22
23/**
24 * A lightweight class that can be used to automatically start and stop a
25 * PStatCollector around a section of code. It's intended to be used in the
26 * following way: create a local PStatTimer variable to start the Collector,
27 * and when the PStatTimer variable goes out of scope (for instance, at the
28 * end of the function), it will automatically stop the Collector.
29 */
30 class PStatTimer {
31 public:
32#ifdef DO_PSTATS
33 INLINE PStatTimer(PStatCollector &collector);
34 INLINE PStatTimer(PStatCollector &collector, Thread *current_thread);
35 INLINE ~PStatTimer();
36
37 protected:
38 PStatCollector &_collector;
39 PStatThread _thread;
40#else // DO_PSTATS
41
42 INLINE PStatTimer(PStatCollector &) { }
43 INLINE PStatTimer(PStatCollector &, Thread *) { }
44 INLINE ~PStatTimer() { }
45
46#endif // DO_PSTATS
47};
48
49#include "pStatTimer.I"
50
51#endif
PStatCollector
A lightweight class that represents a single element that may be timed and/or counted via stats.
Definition pStatCollector.h:43
PStatThread
A lightweight class that represents a single thread of execution to PStats.
Definition pStatThread.h:28
Thread
A thread; that is, a lightweight process.
Definition thread.h:46
pStatCollector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pStatTimer.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.