Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pstatclient/pStatThread.I

Go to the documentation of this file.
00001 // Filename: pStatThread.I
00002 // Created by:  drose (11Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: PStatThread::Default Constructor
00022 //       Access: Private
00023 //  Description: Normally, this constructor is called only from
00024 //               PStatClient.  Use one of the constructors below to
00025 //               create your own Thread.
00026 ////////////////////////////////////////////////////////////////////
00027 INLINE PStatThread::
00028 PStatThread() {
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: PStatThread::Constructor
00033 //       Access: Private
00034 //  Description: Normally, this constructor is called only from
00035 //               PStatClient.  Use one of the constructors below to
00036 //               create your own Thread.
00037 ////////////////////////////////////////////////////////////////////
00038 INLINE PStatThread::
00039 PStatThread(PStatClient *client, int index) :
00040   _client(client),
00041   _index(index)
00042 {
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: PStatThread::Constructor
00047 //       Access: Public
00048 //  Description: Creates a new named thread.  This will be used to
00049 //               unify tasks that share a common thread, and
00050 //               differentiate tasks that occur in different threads.
00051 //               If any two different PStatThread objects share the
00052 //               same name, then they are really the same thread.
00053 ////////////////////////////////////////////////////////////////////
00054 INLINE PStatThread::
00055 PStatThread(const string &name, PStatClient *client) {
00056 #ifdef DO_PSTATS
00057   if (client == (PStatClient *)NULL) {
00058     client = PStatClient::get_global_pstats();
00059   }
00060   PStatThread thread(client->make_thread(name));
00061   (*this) = thread;
00062 #else
00063   _client = (PStatClient *)NULL;
00064   _index = 0;
00065 #endif
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: PStatThread::Copy Constructor
00070 //       Access: Public
00071 //  Description:
00072 ////////////////////////////////////////////////////////////////////
00073 INLINE PStatThread::
00074 PStatThread(const PStatThread &copy) :
00075   _client(copy._client),
00076   _index(copy._index)
00077 {
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: PStatThread::Copy Assignment Operator
00082 //       Access: Public
00083 //  Description:
00084 ////////////////////////////////////////////////////////////////////
00085 INLINE void PStatThread::
00086 operator = (const PStatThread &copy) {
00087   _client = copy._client;
00088   _index = copy._index;
00089 }
00090 
00091 ////////////////////////////////////////////////////////////////////
00092 //     Function: PStatThread::new_frame
00093 //       Access: Public
00094 //  Description: This must be called at the start of every "frame",
00095 //               whatever a frame may be deemed to be, to accumulate
00096 //               all the stats that have collected so far for the
00097 //               thread and ship them off to the server.
00098 ////////////////////////////////////////////////////////////////////
00099 INLINE void PStatThread::
00100 new_frame() {
00101 #ifdef DO_PSTATS
00102   _client->new_frame(_index);
00103 #endif
00104 }

Generated on Fri May 2 00:43:28 2003 for Panda by doxygen1.3