Panda3D
pStatTimer.I
1 // Filename: pStatTimer.I
2 // Created by: drose (11Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 #ifdef DO_PSTATS
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function: PStatTimer::Constructor
20 // Access: Public
21 // Description:
22 ////////////////////////////////////////////////////////////////////
23 INLINE PStatTimer::
24 PStatTimer(PStatCollector &collector) :
25  _collector(collector),
26  _thread(PStatClient::get_global_pstats()->get_current_thread())
27 {
28  _collector.start(_thread);
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function: PStatTimer::Constructor
33 // Access: Public
34 // Description:
35 ////////////////////////////////////////////////////////////////////
36 INLINE PStatTimer::
37 PStatTimer(PStatCollector &collector, Thread *current_thread) :
38  _collector(collector),
39  _thread(current_thread)
40 {
41  _collector.start(_thread);
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: PStatTimer::Destructor
46 // Access: Public
47 // Description:
48 ////////////////////////////////////////////////////////////////////
49 INLINE PStatTimer::
50 ~PStatTimer() {
51  _collector.stop(_thread);
52 }
53 
54 #endif
A lightweight class that represents a single element that may be timed and/or counted via stats...
A thread; that is, a lightweight process.
Definition: thread.h:51
Manages the communications to report statistics via a network connection to a remote PStatServer...
Definition: pStatClient.h:261