no pstats for opt4

This commit is contained in:
cxgeorge 2001-04-28 02:43:07 +00:00
parent 50f0b21898
commit 744b9ac456
24 changed files with 150 additions and 53 deletions

View File

@ -9,7 +9,7 @@
#define USE_NET yes
#define COMPONENT_LIBS \
pvrpn pstatclient grutil chan chancfg \
pvrpn grutil chan chancfg $[if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]], pstatclient] \
char chat collide cull device \
dgraph display gobj graph gsgbase \
gsgmisc light linmath mathutil net \
@ -18,6 +18,9 @@
switchnode text tform tiff lerp loader putil effects \
audio gui pandabase
#define LOCAL_LIBS downloader event ipc express pandabase
#define OTHER_LIBS dtoolconfig dtool

View File

@ -9,7 +9,9 @@
#include <config_display.h>
#include <config_graph.h>
#include <config_pnmimagetypes.h>
#ifdef DO_PSTATS
#include <config_pstats.h>
#endif
#include <config_sgraph.h>
#ifdef LINK_IN_GL
@ -38,7 +40,9 @@ init_libpanda() {
init_libdisplay();
init_libgraph();
init_libpnmimagetypes();
#ifdef DO_PSTATS
init_libpstatclient();
#endif
init_libsgraph();
#ifdef LINK_IN_GL

View File

@ -10,7 +10,7 @@
#define TARGET char
#define LOCAL_LIBS \
chan graph sgraph linmath putil event sgattrib mathutil gsgbase \
pstatclient
$[if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]], pstatclient]
#define SOURCES \
character.I character.cxx character.h characterJoint.cxx \

View File

@ -15,12 +15,15 @@
#include <datagramIterator.h>
#include <bamReader.h>
#include <bamWriter.h>
#include <pStatTimer.h>
TypeHandle Character::_type_handle;
#ifdef DO_PSTATS
#include <pStatTimer.h>
PStatCollector Character::_anim_pcollector =
PStatCollector("Animation", RGBColorf(1,0,1), 30);
#endif
////////////////////////////////////////////////////////////////////
// Function: Character::Copy Constructor
@ -32,8 +35,10 @@ Character(const Character &copy) :
PartBundleNode(copy.get_name(), new CharacterJointBundle(copy.get_name())),
_cv(DynamicVertices::deep_copy(copy._cv)),
_computed_vertices(copy._computed_vertices),
_parts(copy._parts),
_char_pcollector(copy._char_pcollector)
_parts(copy._parts)
#ifdef DO_PSTATS
, _char_pcollector(copy._char_pcollector)
#endif
{
// Now make a copy of the joint/slider hierarchy. We could just use
// the PartBundleNode's copy constructor, but if we do it ourselves
@ -49,9 +54,10 @@ Character(const Character &copy) :
////////////////////////////////////////////////////////////////////
Character::
Character(const string &name) :
PartBundleNode(name, new CharacterJointBundle(name)),
_char_pcollector(_anim_pcollector,
name.empty() ? string("Unnamed Character") : name)
PartBundleNode(name, new CharacterJointBundle(name))
#ifdef DO_PSTATS
, _char_pcollector(_anim_pcollector, name.empty() ? string("Unnamed Character") : name)
#endif
{
}
@ -121,8 +127,10 @@ app_traverse() {
////////////////////////////////////////////////////////////////////
void Character::
update() {
#ifdef DO_PSTATS
// Statistics
PStatTimer timer(_char_pcollector);
#endif
// First, update all the joints and sliders.
get_bundle()->update();
@ -421,11 +429,13 @@ fillin(DatagramIterator& scan, BamReader* manager)
_parts.push_back((PartGroup *)NULL);
}
#ifdef DO_PSTATS
// Reinitialize our collector with our name, now that we know it.
if (has_name()) {
_char_pcollector =
PStatCollector(_anim_pcollector, get_name());
}
#endif
}
////////////////////////////////////////////////////////////////////

View File

@ -13,10 +13,13 @@
#include <partBundleNode.h>
#include <namedNode.h>
#include <vector_PartGroupStar.h>
#include <pStatCollector.h>
#include <pointerTo.h>
#include <geom.h>
#ifdef DO_PSTATS
#include <pStatCollector.h>
#endif
class CharacterJointBundle;
class ComputedVertices;
@ -79,9 +82,11 @@ private:
typedef vector_PartGroupStar Parts;
Parts _parts;
// Statistics
PStatCollector _char_pcollector;
static PStatCollector _anim_pcollector;
#ifdef DO_PSTATS
// Statistics
PStatCollector _char_pcollector;
static PStatCollector _anim_pcollector;
#endif
public:
static void register_with_read_factory(void);

View File

@ -9,7 +9,7 @@
#begin lib_target
#define TARGET collide
#define LOCAL_LIBS \
sgmanip light tform sgraphutil gobj graph putil
sgmanip light tform sgraphutil gobj graph putil $[if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]], pstatclient]
#define SOURCES \
collisionEntry.I collisionEntry.cxx collisionEntry.h \

View File

@ -13,14 +13,16 @@
#include <wrt.h>
#include <get_rel_pos.h>
#include <transformTransition.h>
#include <pStatTimer.h>
#include <geomNode.h>
#include <geom.h>
#include <nodePath.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
PStatCollector CollisionTraverser::_collisions_pcollector =
PStatCollector("Collisions", RGBColorf(1,0.5,0), 40);
#endif
////////////////////////////////////////////////////////////////////
// Function: CollisionTraverser::Constructor
@ -230,7 +232,9 @@ void CollisionTraverser::
traverse(const NodePath &root) {
nassertv(root.get_graph_type() == _graph_type);
#ifdef DO_PSTATS
PStatTimer timer(_collisions_pcollector);
#endif
CollisionLevelState level_state(root);
prepare_colliders(level_state);

View File

@ -16,9 +16,12 @@
#include <nullAttributeWrapper.h>
#include <pointerTo.h>
#include <renderRelation.h>
#include <pStatCollector.h>
#include <pointerTo.h>
#ifdef DO_PSTATS
#include <pStatCollector.h>
#endif
#include <set>
class CollisionNode;
@ -89,8 +92,10 @@ private:
typedef map<PT(CollisionHandler), int> Handlers;
Handlers _handlers;
// Statistics
static PStatCollector _collisions_pcollector;
#ifdef DO_PSTATS
// Statistics
static PStatCollector _collisions_pcollector;
#endif
};
INLINE ostream &operator << (ostream &out, const CollisionTraverser &trav) {

View File

@ -10,7 +10,7 @@
#define TARGET cull
#define LOCAL_LIBS \
gobj sgraphutil graph putil sgraph mathutil sgattrib display \
pstatclient
$[if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]], pstatclient]
#define SOURCES \
config_cull.cxx config_cull.h cullState.I cullState.cxx cullState.h \

View File

@ -22,17 +22,18 @@
#include <indent.h>
#include <config_sgraphutil.h> // for implicit_app_traversal
#include <config_sgattrib.h> // for support_decals
#include <pStatTimer.h>
#include <string_utils.h>
TypeHandle CullTraverser::_type_handle;
#ifdef DO_PSTATS
#include <pStatTimer.h>
PStatCollector CullTraverser::_cull_pcollector =
PStatCollector("Cull", RGBColorf(0,1,0), 10);
PStatCollector CullTraverser::_draw_pcollector =
PStatCollector("Draw", RGBColorf(1,0,0), 20);
#endif
////////////////////////////////////////////////////////////////////
// Function: CullTraverser::Constructor
@ -172,8 +173,10 @@ void CullTraverser::
traverse(Node *root,
const AllAttributesWrapper &initial_state,
const AllTransitionsWrapper &net_trans) {
#ifdef DO_PSTATS
// Statistics
PStatTimer timer(_cull_pcollector);
#endif
if (cull_cat.is_debug()) {
cull_cat.debug()

View File

@ -16,7 +16,10 @@
#include <traverserVisitor.h>
#include <nullTransitionWrapper.h>
#include <nullAttributeWrapper.h>
#ifdef DO_PSTATS
#include <pStatCollector.h>
#endif
#include <list>
#include <set>
@ -119,10 +122,12 @@ private:
UpdateSeq _now;
public:
// Statistics
static PStatCollector _cull_pcollector;
static PStatCollector _draw_pcollector;
#ifdef DO_PSTATS
// Statistics
static PStatCollector _cull_pcollector;
static PStatCollector _draw_pcollector;
#endif
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -11,7 +11,10 @@
#include <transformTransition.h>
#include <transformAttribute.h>
#include <geometricBoundingVolume.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
#endif
TypeHandle GeomBinBackToFront::_type_handle;
@ -135,7 +138,9 @@ record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int,
////////////////////////////////////////////////////////////////////
void GeomBinBackToFront::
draw(CullTraverser *trav) {
#ifdef DO_PSTATS
PStatTimer timer(CullTraverser::_draw_pcollector);
#endif
if (cull_cat.is_spam()) {
cull_cat.spam()
<< "GeomBinBackToFront drawing " << _node_entries.size() << " entries.\n";

View File

@ -12,7 +12,10 @@
#include <transformAttribute.h>
#include <geometricBoundingVolume.h>
#include <directRenderTraverser.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
#endif
TypeHandle GeomBinFixed::_type_handle;
@ -64,7 +67,9 @@ record_current_state(GraphicsStateGuardian *, CullState *cs,
////////////////////////////////////////////////////////////////////
void GeomBinFixed::
draw(CullTraverser *trav) {
#ifdef DO_PSTATS
PStatTimer timer(CullTraverser::_draw_pcollector);
#endif
NodeEntries::iterator nei;
for (nei = _node_entries.begin(); nei != _node_entries.end(); ++nei) {
(*nei).draw(trav);

View File

@ -9,7 +9,10 @@
#include <indent.h>
#include <nodeAttributes.h>
#include <graphicsStateGuardian.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
#endif
TypeHandle GeomBinUnsorted::_type_handle;
@ -66,7 +69,9 @@ record_current_state(GraphicsStateGuardian *, CullState *cs, int,
////////////////////////////////////////////////////////////////////
void GeomBinUnsorted::
draw(CullTraverser *trav) {
#ifdef DO_PSTATS
PStatTimer timer(CullTraverser::_draw_pcollector);
#endif
GraphicsStateGuardian *gsg = trav->get_gsg();
if (cull_cat.is_spam()) {

View File

@ -9,7 +9,8 @@
#begin lib_target
#define TARGET display
#define LOCAL_LIBS \
putil gsgbase gobj linmath graph mathutil sgraph pstatclient
putil gsgbase gobj linmath graph mathutil sgraph \
$[if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]], pstatclient]
#define SOURCES \
config_display.cxx config_display.h displayRegion.I \

View File

@ -24,6 +24,7 @@ TypeHandle GraphicsWindow::WindowPipe::_type_handle;
GraphicsWindow::WindowFactory *GraphicsWindow::_factory = NULL;
#ifdef DO_PSTATS
PStatCollector GraphicsWindow::_app_pcollector =
PStatCollector("App", RGBColorf(0,1,1));
PStatCollector GraphicsWindow::_show_code_pcollector =
@ -32,7 +33,7 @@ PStatCollector GraphicsWindow::_swap_pcollector =
PStatCollector("Draw:Swap Buffers", RGBColorf(0.5,1,0.8));
PStatCollector GraphicsWindow::_make_current_pcollector =
PStatCollector("Draw:Make Current", RGBColorf(1,0.6,0.3));
#endif
////////////////////////////////////////////////////////////////////
// Function: GraphicsWindow::Properties::Constructor

View File

@ -24,7 +24,10 @@
#include <buttonEvent.h>
#include <iterator_types.h>
#include <factory.h>
#ifdef DO_PSTATS
#include <pStatCollector.h>
#endif
#include <string>
#include <vector>
@ -155,11 +158,13 @@ public:
virtual void begin_frame();
virtual void end_frame();
// Statistics
static PStatCollector _app_pcollector;
static PStatCollector _show_code_pcollector;
static PStatCollector _swap_pcollector; // dxgsg needs access so this is public
static PStatCollector _make_current_pcollector;
#ifdef DO_PSTATS
// Statistics
static PStatCollector _app_pcollector;
static PStatCollector _show_code_pcollector;
static PStatCollector _swap_pcollector; // dxgsg needs access so this is public
static PStatCollector _make_current_pcollector;
#endif
protected:
void make_gsg();

View File

@ -3,10 +3,10 @@
//
////////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include "dxSavedFrameBuffer.h"
#include "config_dxgsg.h"
#include "dxGraphicsStateGuardian.h"
#include <pStatTimer.h>
#include <directRenderTraverser.h>
#include <cullTraverser.h>
#include <displayRegion.h>
@ -66,7 +66,9 @@
#include <stencilTransition.h>
#include <throw_event.h>
#include <pandabase.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
#endif
#define DISABLE_POLYGON_OFFSET_DECALING
// currently doesnt work well enough in toontown models for us to use
@ -1200,7 +1202,7 @@ draw_point(const GeomPoint *geom) {
// Geom nodes store floats for colors, drawprim requires ARGB dwords
// BUGBUG: eventually this hack every-frame all-colors conversion needs
// to be done only once as part of a vertex buffer
if(_color_transform_enabled || _alpha_transform_enabled) {
for (int i=0;i<nPrims;i++) {
D3DCOLOR RGBA_color;
@ -2005,14 +2007,15 @@ draw_tri(const GeomTri *geom) {
D3DSHADEMODE NeededShadeMode = D3DSHADE_FLAT;
DWORD dwVertsPerPrim=geom->get_num_vertices_per_prim();
const DWORD dwVertsPerPrim=3;
if ((NormalBinding != G_OFF) && wants_normals()) {
dps_data.normal.lpvData = (VOID*)norms;
dps_data.normal.dwStride = sizeof(D3DVECTOR);
#ifdef _DEBUG
nassertv(geom->get_num_vertices_per_prim()==3);
nassertv( nPrims*dwVertsPerPrim*sizeof(D3DVECTOR) <= D3DMAXNUMVERTICES*sizeof(WORD));
if (NormalBinding==G_PER_VERTEX)
nassertv(norms.size()>=nPrims*dwVertsPerPrim);
@ -2437,7 +2440,7 @@ draw_multitri(const Geom *geom, D3DPRIMITIVETYPE trilisttype) {
cTotalVerts+= pLengthArr[i];
}
DWORD cNumMoreVertsthanTris=geom->get_num_more_vertices_than_components();
const DWORD cNumMoreVertsthanTris=2;
if((NormalBinding != G_OFF) && wants_normals()) {
@ -2445,6 +2448,7 @@ draw_multitri(const Geom *geom, D3DPRIMITIVETYPE trilisttype) {
dps_data.normal.dwStride = sizeof(D3DVECTOR);
#ifdef _DEBUG
nassertv(geom->get_num_more_vertices_than_components()==2);
nassertv(NormalBinding!=G_PER_COMPONENT); // makes no sense, unimplementable for strips since normals always shared across tris
nassertv( cTotalVerts*sizeof(D3DVECTOR) <= D3DMAXNUMVERTICES*sizeof(WORD));
if(NormalBinding==G_PER_VERTEX)
@ -5387,7 +5391,9 @@ HRESULT DXGraphicsStateGuardian::RestoreAllVideoSurfaces(void) {
// Description: Repaint primary buffer from back buffer (windowed mode only)
////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian::show_frame(void) {
#ifdef DO_PSTATS
PStatTimer timer(_win->_swap_pcollector); // this times just the flip, so it must go here in dxgsg, instead of wdxdisplay, which would time the whole frame
#endif
if(_pri==NULL)
return;

View File

@ -410,7 +410,7 @@ void event_esc(CPT_Event) {
rib_pipe = NULL;
rib_win = NULL;
#ifdef HAVE_NET
#if defined(HAVE_NET) && defined(DO_PSTATS)
if (PStatClient::get_global_pstats()->is_connected()) {
framework_cat.info() << "Disconnecting from stats host" << endl;
PStatClient::get_global_pstats()->disconnect();
@ -438,7 +438,9 @@ void event_f(CPT_Event) {
}
void event_S(CPT_Event) {
#ifdef HAVE_NET
#ifndef DO_PSTATS
framework_cat.error() << "demo not compiled with PStats support." << endl;
#elif defined(HAVE_NET)
framework_cat.info() << "Connecting to stats host" << endl;
PStatClient::get_global_pstats()->connect();
#else
@ -447,7 +449,9 @@ void event_S(CPT_Event) {
}
void event_A(CPT_Event) {
#ifdef HAVE_NET
#ifndef DO_PSTATS
framework_cat.error() << "demo not compiled with PStats support." << endl;
#elif defined(HAVE_NET)
if (PStatClient::get_global_pstats()->is_connected()) {
framework_cat.info() << "Disconnecting from stats host" << endl;
PStatClient::get_global_pstats()->disconnect();

View File

@ -2,10 +2,12 @@
dtoolutil:c dtoolbase:c dtool:m
#begin lib_target
#define TARGET pstatclient
#define LOCAL_LIBS \
net linmath putil express
#if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]]
#define TARGET pstatclient
#define SOURCES \
config_pstats.cxx config_pstats.h pStatClient.I pStatClient.cxx \
pStatClient.h pStatClientControlMessage.cxx \
@ -22,6 +24,12 @@
pStatTimer.I pStatTimer.h
#define IGATESCAN all
#else
#define TARGET
#define SOURCES
#define INSTALL_HEADERS
#define IGATESCAN
#endif
#end lib_target

View File

@ -23,12 +23,15 @@
#include <nodeTransitionWrapper.h>
#include <decalTransition.h>
#include <decalAttribute.h>
#include <pStatTimer.h>
#include <config_sgattrib.h> // for support_decals
TypeHandle DirectRenderTraverser::_type_handle;
#ifdef DO_PSTATS
#include <pStatTimer.h>
PStatCollector DirectRenderTraverser::_draw_pcollector =
PStatCollector("Draw", RGBColorf(1,0,0), 20);
#endif
////////////////////////////////////////////////////////////////////
// Function: DirectRenderTraverser::Constructor
@ -63,8 +66,10 @@ void DirectRenderTraverser::
traverse(Node *root,
const AllAttributesWrapper &initial_state,
const AllTransitionsWrapper &net_trans) {
#ifdef DO_PSTATS
// Statistics
PStatTimer timer(_draw_pcollector);
#endif
AllAttributesWrapper render_state;
render_state.apply_from(initial_state, net_trans);

View File

@ -17,9 +17,12 @@
#include <allAttributesWrapper.h>
#include <geometricBoundingVolume.h>
#include <lmatrix.h>
#include <pStatCollector.h>
#include <pointerTo.h>
#ifdef DO_PSTATS
#include <pStatCollector.h>
#endif
class Node;
class GraphicsStateGuardian;
class GeometricBoundingVolume;
@ -60,9 +63,10 @@ public:
const DirectRenderLevelState &level_state);
private:
// Statistics
static PStatCollector _draw_pcollector;
#ifdef DO_PSTATS
// Statistics
static PStatCollector _draw_pcollector;
#endif
public:
static TypeHandle get_class_type() {

View File

@ -4,7 +4,7 @@
framework putil collide loader sgmanip chan text chancfg cull \
pnmimage pnmimagetypes event effects shader graph gobj display \
mathutil sgattrib putil express light dgraph device tform sgraph \
linmath pstatclient sgraphutil panda
linmath sgraphutil panda $[if $[or $[<= $[OPTIMIZE],3], $[ne $[DO_PSTATS],]], pstatclient]
#if $[LINK_ALL_STATIC]
// If we're statically linking, we need to explicitly link with

View File

@ -3,18 +3,20 @@
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include "wglGraphicsWindow.h"
#include "wglGraphicsPipe.h"
#include "config_wgldisplay.h"
#include <keyboardButton.h>
#include <mouseButton.h>
#include <glGraphicsStateGuardian.h>
#include <pStatTimer.h>
#include <errno.h>
#include <time.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
#endif
////////////////////////////////////////////////////////////////////
// Static variables
////////////////////////////////////////////////////////////////////
@ -846,7 +848,9 @@ void wglGraphicsWindow::setup_colormap(void) {
////////////////////////////////////////////////////////////////////
void wglGraphicsWindow::end_frame(void) {
{
#ifdef DO_PSTATS
PStatTimer timer(_swap_pcollector);
#endif
SwapBuffers(_hdc);
}
GraphicsWindow::end_frame();
@ -994,8 +998,10 @@ supports_update() const {
// Description:
////////////////////////////////////////////////////////////////////
void wglGraphicsWindow::update(void) {
#ifdef DO_PSTATS
_show_code_pcollector.stop();
PStatClient::main_tick();
#endif
if (_change_mask)
handle_changes();
@ -1008,8 +1014,9 @@ void wglGraphicsWindow::update(void) {
idle_wait();
else
process_events();
#ifdef DO_PSTATS
_show_code_pcollector.start();
#endif
}
////////////////////////////////////////////////////////////////////
@ -1045,7 +1052,9 @@ void wglGraphicsWindow::enable_mouse_passive_motion(bool val) {
// Description:
////////////////////////////////////////////////////////////////////
void wglGraphicsWindow::make_current(void) {
#ifdef DO_PSTATS
PStatTimer timer(_make_current_pcollector);
#endif
HGLRC current_context = wglGetCurrentContext();
HDC current_dc = wglGetCurrentDC();
if (current_context != _context || current_dc != _hdc)