mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
separate readerPollTask into its constituent update/generate/other pieces
This commit is contained in:
parent
68da034d9e
commit
0778ad00be
@ -1,5 +1,6 @@
|
|||||||
#define OTHER_LIBS \
|
#define OTHER_LIBS \
|
||||||
express:c pandaexpress:m \
|
express:c pandaexpress:m \
|
||||||
|
pstatclient:c panda:m \
|
||||||
interrogatedb:c dconfig:c dtoolconfig:m \
|
interrogatedb:c dconfig:c dtoolconfig:m \
|
||||||
dtoolutil:c dtoolbase:c dtool:m
|
dtoolutil:c dtoolbase:c dtool:m
|
||||||
#define LOCAL_LIBS \
|
#define LOCAL_LIBS \
|
||||||
@ -15,7 +16,7 @@
|
|||||||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
||||||
|
|
||||||
#define SOURCES \
|
#define SOURCES \
|
||||||
dcAtomicField.h dcClass.h \
|
dcAtomicField.h dcClass.h dcClass.I \
|
||||||
dcDeclaration.h \
|
dcDeclaration.h \
|
||||||
dcField.h dcFile.h dcLexer.lxx \
|
dcField.h dcFile.h dcLexer.lxx \
|
||||||
dcLexerDefs.h dcMolecularField.h dcParser.yxx dcParserDefs.h \
|
dcLexerDefs.h dcMolecularField.h dcParser.yxx dcParserDefs.h \
|
||||||
|
76
direct/src/dcparser/dcClass.I
Normal file
76
direct/src/dcparser/dcClass.I
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// Filename: dcClass.I
|
||||||
|
// Created by: drose (15Sep04)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d-general@lists.sourceforge.net .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCClass::is_struct
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the class has been identified with
|
||||||
|
// the "struct" keyword in the dc file, false if it was
|
||||||
|
// declared with "dclass".
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool DCClass::
|
||||||
|
is_struct() const {
|
||||||
|
return _is_struct;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCClass::is_bogus_class
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the class has been flagged as a bogus
|
||||||
|
// class. This is set for classes that are generated by
|
||||||
|
// the parser as placeholder for missing classes, as
|
||||||
|
// when reading a partial file; it should not occur in a
|
||||||
|
// normal valid dc file.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool DCClass::
|
||||||
|
is_bogus_class() const {
|
||||||
|
return _bogus_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCClass::start_generate
|
||||||
|
// Access: Public
|
||||||
|
// Description: Starts the PStats timer going on the "generate" task,
|
||||||
|
// that is, marks the beginning of the process of
|
||||||
|
// generating a new object, for the purposes of timing
|
||||||
|
// this process.
|
||||||
|
//
|
||||||
|
// This should balance with a corresponding call to
|
||||||
|
// stop_generate().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DCClass::
|
||||||
|
start_generate() {
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
_class_generate_pcollector.start();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCClass::stop_generate
|
||||||
|
// Access: Public
|
||||||
|
// Description: Stops the PStats timer on the "generate" task.
|
||||||
|
// This should balance with a preceding call to
|
||||||
|
// start_generate().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void DCClass::
|
||||||
|
stop_generate() {
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
_class_generate_pcollector.stop();
|
||||||
|
#endif
|
||||||
|
}
|
@ -24,6 +24,15 @@
|
|||||||
|
|
||||||
#include "dcClassParameter.h"
|
#include "dcClassParameter.h"
|
||||||
|
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
#include "pStatTimer.h"
|
||||||
|
|
||||||
|
#ifndef CPPPARSER
|
||||||
|
PStatCollector DCClass::_update_pcollector("App:Show code:readerPollTask:Update");
|
||||||
|
PStatCollector DCClass::_generate_pcollector("App:Show code:readerPollTask:Generate");
|
||||||
|
#endif // CPPPARSER
|
||||||
|
#endif // WITHIN_PANDA
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DCClass::Constructor
|
// Function: DCClass::Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -31,6 +40,10 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
DCClass::
|
DCClass::
|
||||||
DCClass(const string &name, bool is_struct, bool bogus_class) :
|
DCClass(const string &name, bool is_struct, bool bogus_class) :
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
_class_update_pcollector(_update_pcollector, name),
|
||||||
|
_class_generate_pcollector(_generate_pcollector, name),
|
||||||
|
#endif
|
||||||
_name(name),
|
_name(name),
|
||||||
_is_struct(is_struct),
|
_is_struct(is_struct),
|
||||||
_bogus_class(bogus_class)
|
_bogus_class(bogus_class)
|
||||||
@ -247,32 +260,6 @@ get_inherited_field(int n) const {
|
|||||||
return get_field(n);
|
return get_field(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCClass::is_struct
|
|
||||||
// Access: Public
|
|
||||||
// Description: Returns true if the class has been identified with
|
|
||||||
// the "struct" keyword in the dc file, false if it was
|
|
||||||
// declared with "dclass".
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCClass::
|
|
||||||
is_struct() const {
|
|
||||||
return _is_struct;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCClass::is_bogus_class
|
|
||||||
// Access: Public
|
|
||||||
// Description: Returns true if the class has been flagged as a bogus
|
|
||||||
// class. This is set for classes that are generated by
|
|
||||||
// the parser as placeholder for missing classes, as
|
|
||||||
// when reading a partial file; it should not occur in a
|
|
||||||
// normal valid dc file.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCClass::
|
|
||||||
is_bogus_class() const {
|
|
||||||
return _bogus_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DCClass::has_class_def
|
// Function: DCClass::has_class_def
|
||||||
@ -331,6 +318,9 @@ get_class_def() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCClass::
|
void DCClass::
|
||||||
receive_update(PyObject *distobj, DatagramIterator &di) const {
|
receive_update(PyObject *distobj, DatagramIterator &di) const {
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
PStatTimer timer(((DCClass *)this)->_class_update_pcollector);
|
||||||
|
#endif
|
||||||
DCPacker packer;
|
DCPacker packer;
|
||||||
packer.set_unpack_data(di.get_remaining_bytes());
|
packer.set_unpack_data(di.get_remaining_bytes());
|
||||||
|
|
||||||
@ -356,6 +346,9 @@ receive_update(PyObject *distobj, DatagramIterator &di) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCClass::
|
void DCClass::
|
||||||
receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const {
|
receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const {
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
PStatTimer timer(((DCClass *)this)->_class_update_pcollector);
|
||||||
|
#endif
|
||||||
DCPacker packer;
|
DCPacker packer;
|
||||||
packer.set_unpack_data(di.get_remaining_bytes());
|
packer.set_unpack_data(di.get_remaining_bytes());
|
||||||
|
|
||||||
@ -388,6 +381,9 @@ receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCClass::
|
void DCClass::
|
||||||
receive_update_all_required(PyObject *distobj, DatagramIterator &di) const {
|
receive_update_all_required(PyObject *distobj, DatagramIterator &di) const {
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
PStatTimer timer(((DCClass *)this)->_class_update_pcollector);
|
||||||
|
#endif
|
||||||
DCPacker packer;
|
DCPacker packer;
|
||||||
packer.set_unpack_data(di.get_remaining_bytes());
|
packer.set_unpack_data(di.get_remaining_bytes());
|
||||||
|
|
||||||
@ -417,6 +413,9 @@ receive_update_all_required(PyObject *distobj, DatagramIterator &di) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCClass::
|
void DCClass::
|
||||||
receive_update_other(PyObject *distobj, DatagramIterator &di) const {
|
receive_update_other(PyObject *distobj, DatagramIterator &di) const {
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
PStatTimer timer(((DCClass *)this)->_class_update_pcollector);
|
||||||
|
#endif
|
||||||
int num_fields = di.get_uint16();
|
int num_fields = di.get_uint16();
|
||||||
for (int i = 0; i < num_fields && !PyErr_Occurred(); i++) {
|
for (int i = 0; i < num_fields && !PyErr_Occurred(); i++) {
|
||||||
receive_update(distobj, di);
|
receive_update(distobj, di);
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
#include "dcDeclaration.h"
|
#include "dcDeclaration.h"
|
||||||
#include "dcPython.h"
|
#include "dcPython.h"
|
||||||
|
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
#include "pStatCollector.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class HashGenerator;
|
class HashGenerator;
|
||||||
class DCParameter;
|
class DCParameter;
|
||||||
|
|
||||||
@ -57,8 +61,11 @@ PUBLISHED:
|
|||||||
int get_num_inherited_fields() const;
|
int get_num_inherited_fields() const;
|
||||||
DCField *get_inherited_field(int n) const;
|
DCField *get_inherited_field(int n) const;
|
||||||
|
|
||||||
bool is_struct() const;
|
INLINE bool is_struct() const;
|
||||||
bool is_bogus_class() const;
|
INLINE bool is_bogus_class() const;
|
||||||
|
|
||||||
|
INLINE void start_generate();
|
||||||
|
INLINE void stop_generate();
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
bool has_class_def() const;
|
bool has_class_def() const;
|
||||||
@ -101,6 +108,13 @@ public:
|
|||||||
void set_number(int number);
|
void set_number(int number);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef WITHIN_PANDA
|
||||||
|
PStatCollector _class_update_pcollector;
|
||||||
|
PStatCollector _class_generate_pcollector;
|
||||||
|
static PStatCollector _update_pcollector;
|
||||||
|
static PStatCollector _generate_pcollector;
|
||||||
|
#endif
|
||||||
|
|
||||||
string _name;
|
string _name;
|
||||||
bool _is_struct;
|
bool _is_struct;
|
||||||
bool _bogus_class;
|
bool _bogus_class;
|
||||||
@ -122,4 +136,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "dcClass.I"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,8 +101,10 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
doId = di.getUint32()
|
doId = di.getUint32()
|
||||||
# Look up the dclass
|
# Look up the dclass
|
||||||
dclass = self.dclassesByNumber[classId]
|
dclass = self.dclassesByNumber[classId]
|
||||||
|
dclass.startGenerate()
|
||||||
# Create a new distributed object, and put it in the dictionary
|
# Create a new distributed object, and put it in the dictionary
|
||||||
distObj = self.generateWithRequiredFields(dclass, doId, di)
|
distObj = self.generateWithRequiredFields(dclass, doId, di)
|
||||||
|
dclass.stopGenerate()
|
||||||
|
|
||||||
def handleGenerateWithRequiredOther(self, di):
|
def handleGenerateWithRequiredOther(self, di):
|
||||||
# Get the class Id
|
# Get the class Id
|
||||||
@ -111,8 +113,10 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
doId = di.getUint32()
|
doId = di.getUint32()
|
||||||
# Look up the dclass
|
# Look up the dclass
|
||||||
dclass = self.dclassesByNumber[classId]
|
dclass = self.dclassesByNumber[classId]
|
||||||
|
dclass.startGenerate()
|
||||||
# Create a new distributed object, and put it in the dictionary
|
# Create a new distributed object, and put it in the dictionary
|
||||||
distObj = self.generateWithRequiredOtherFields(dclass, doId, di)
|
distObj = self.generateWithRequiredOtherFields(dclass, doId, di)
|
||||||
|
dclass.stopGenerate()
|
||||||
|
|
||||||
def handleQuietZoneGenerateWithRequired(self, di):
|
def handleQuietZoneGenerateWithRequired(self, di):
|
||||||
# Special handler for quiet zone generates -- we need to filter
|
# Special handler for quiet zone generates -- we need to filter
|
||||||
@ -122,11 +126,13 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
doId = di.getUint32()
|
doId = di.getUint32()
|
||||||
# Look up the dclass
|
# Look up the dclass
|
||||||
dclass = self.dclassesByNumber[classId]
|
dclass = self.dclassesByNumber[classId]
|
||||||
|
dclass.startGenerate()
|
||||||
# If the class is a neverDisable class (which implies uberzone) we
|
# If the class is a neverDisable class (which implies uberzone) we
|
||||||
# should go ahead and generate it even though we are in the quiet zone
|
# should go ahead and generate it even though we are in the quiet zone
|
||||||
if dclass.getClassDef().neverDisable:
|
if dclass.getClassDef().neverDisable:
|
||||||
# Create a new distributed object, and put it in the dictionary
|
# Create a new distributed object, and put it in the dictionary
|
||||||
distObj = self.generateWithRequiredFields(dclass, doId, di)
|
distObj = self.generateWithRequiredFields(dclass, doId, di)
|
||||||
|
dclass.stopGenerate()
|
||||||
|
|
||||||
def handleQuietZoneGenerateWithRequiredOther(self, di):
|
def handleQuietZoneGenerateWithRequiredOther(self, di):
|
||||||
# Special handler for quiet zone generates -- we need to filter
|
# Special handler for quiet zone generates -- we need to filter
|
||||||
@ -138,9 +144,11 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
dclass = self.dclassesByNumber[classId]
|
dclass = self.dclassesByNumber[classId]
|
||||||
# If the class is a neverDisable class (which implies uberzone) we
|
# If the class is a neverDisable class (which implies uberzone) we
|
||||||
# should go ahead and generate it even though we are in the quiet zone
|
# should go ahead and generate it even though we are in the quiet zone
|
||||||
|
dclass.startGenerate()
|
||||||
if dclass.getClassDef().neverDisable:
|
if dclass.getClassDef().neverDisable:
|
||||||
# Create a new distributed object, and put it in the dictionary
|
# Create a new distributed object, and put it in the dictionary
|
||||||
distObj = self.generateWithRequiredOtherFields(dclass, doId, di)
|
distObj = self.generateWithRequiredOtherFields(dclass, doId, di)
|
||||||
|
dclass.stopGenerate()
|
||||||
|
|
||||||
def generateWithRequiredFields(self, dclass, doId, di):
|
def generateWithRequiredFields(self, dclass, doId, di):
|
||||||
if self.doId2do.has_key(doId):
|
if self.doId2do.has_key(doId):
|
||||||
@ -410,10 +418,12 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
# watch for setZoneDones
|
# watch for setZoneDones
|
||||||
if msgType == CLIENT_DONE_SET_ZONE_RESP:
|
if msgType == CLIENT_DONE_SET_ZONE_RESP:
|
||||||
self.handleSetZoneDone()
|
self.handleSetZoneDone()
|
||||||
|
|
||||||
if self.handler == None:
|
if self.handler == None:
|
||||||
self.handleUnexpectedMsgType(msgType, di)
|
self.handleUnexpectedMsgType(msgType, di)
|
||||||
else:
|
else:
|
||||||
self.handler(msgType, di)
|
self.handler(msgType, di)
|
||||||
|
|
||||||
# If we're processing a lot of datagrams within one frame, we
|
# If we're processing a lot of datagrams within one frame, we
|
||||||
# may forget to send heartbeats. Keep them coming!
|
# may forget to send heartbeats. Keep them coming!
|
||||||
self.considerHeartbeat()
|
self.considerHeartbeat()
|
||||||
|
@ -25,9 +25,15 @@
|
|||||||
#include "urlSpec.h"
|
#include "urlSpec.h"
|
||||||
#include "datagramIterator.h"
|
#include "datagramIterator.h"
|
||||||
#include "throw_event.h"
|
#include "throw_event.h"
|
||||||
|
#include "pStatTimer.h"
|
||||||
|
|
||||||
|
|
||||||
const string CConnectionRepository::_overflow_event_name = "CRDatagramOverflow";
|
const string CConnectionRepository::_overflow_event_name = "CRDatagramOverflow";
|
||||||
|
|
||||||
|
#ifndef CPPPARSER
|
||||||
|
PStatCollector CConnectionRepository::_update_pcollector("App:Show code:readerPollTask:Update");
|
||||||
|
#endif // CPPPARSER
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CConnectionRepository::Constructor
|
// Function: CConnectionRepository::Constructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
@ -379,6 +385,7 @@ do_check_datagram() {
|
|||||||
bool CConnectionRepository::
|
bool CConnectionRepository::
|
||||||
handle_update_field() {
|
handle_update_field() {
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
|
PStatTimer timer(_update_pcollector);
|
||||||
int do_id = _di.get_uint32();
|
int do_id = _di.get_uint32();
|
||||||
if (_python_repository != (PyObject *)NULL) {
|
if (_python_repository != (PyObject *)NULL) {
|
||||||
PyObject *doId2do =
|
PyObject *doId2do =
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "dcbase.h"
|
#include "dcbase.h"
|
||||||
#include "dcFile.h"
|
#include "dcFile.h"
|
||||||
#include "dcField.h" // to pick up Python.h
|
#include "dcField.h" // to pick up Python.h
|
||||||
|
#include "pStatCollector.h"
|
||||||
|
|
||||||
#ifdef HAVE_NSPR
|
#ifdef HAVE_NSPR
|
||||||
#include "queuedConnectionManager.h"
|
#include "queuedConnectionManager.h"
|
||||||
@ -130,6 +131,8 @@ private:
|
|||||||
unsigned int _msg_type;
|
unsigned int _msg_type;
|
||||||
|
|
||||||
static const string _overflow_event_name;
|
static const string _overflow_event_name;
|
||||||
|
|
||||||
|
static PStatCollector _update_pcollector;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "cConnectionRepository.I"
|
#include "cConnectionRepository.I"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user