[poppler] poppler/poppler: Gfx.cc, 1.1.1.1, 1.2 Gfx.h, 1.1.1.1,
1.2 GlobalParams.cc, 1.7, 1.8 GlobalParams.h, 1.2,
1.3 Makefile.am, 1.10, 1.11 OutputDev.cc, 1.1.1.1,
1.2 OutputDev.h, 1.1.1.1, 1.2 ProfileData.cc, NONE,
1.1 ProfileData.h, NONE, 1.1
Jonathan Blandford
jrb at freedesktop.org
Tue Aug 23 11:20:47 PDT 2005
- Previous message: [poppler] poppler/test: Makefile.am, 1.1.1.1, 1.2 pdf-inspector.cc,
NONE, 1.1 pdf-inspector.glade, NONE, 1.1 pdf-operators.c, NONE, 1.1
- Next message: [poppler] poppler/test: Makefile.am,1.1.1.1,1.1.1.1.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv7475/poppler
Modified Files:
Gfx.cc Gfx.h GlobalParams.cc GlobalParams.h Makefile.am
OutputDev.cc OutputDev.h
Added Files:
ProfileData.cc ProfileData.h
Log Message:
Tue Aug 23 13:38:01 2005 Jonathan Blandford <jrb at redhat.com>
* configure.ac:
* poppler/Gfx.cc:
* poppler/Gfx.h:
* poppler/GlobalParams.cc:
* poppler/GlobalParams.h:
* poppler/Makefile.am:
* poppler/OutputDev.cc:
* poppler/OutputDev.h:
* poppler/ProfileData.cc:
* poppler/ProfileData.h:
* test/Makefile.am:
* test/pdf-inspector.cc:
* test/pdf-inspector.glade:
* test/pdf-operators.c: Initial cut at a pdf inspector. This
should help us look at PDF files.
Index: Gfx.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Gfx.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Gfx.cc 3 Mar 2005 19:46:02 -0000 1.1.1.1
+++ Gfx.cc 23 Aug 2005 18:20:45 -0000 1.2
@@ -17,6 +17,8 @@
#include <string.h>
#include <math.h>
#include "goo/gmem.h"
+#include "goo/GooTimer.h"
+#include "goo/GooHash.h"
#include "GlobalParams.h"
#include "CharTypes.h"
#include "Object.h"
@@ -31,6 +33,7 @@
#include "Page.h"
#include "Error.h"
#include "Gfx.h"
+#include "ProfileData.h"
// the MSVC math.h doesn't define this
#ifndef M_PI
@@ -414,6 +417,7 @@
xref = xrefA;
subPage = gFalse;
printCommands = globalParams->getPrintCommands();
+ profileCommands = globalParams->getProfileCommands();
// start the resource stack
res = new GfxResources(xref, resDict, NULL);
@@ -530,6 +534,7 @@
Object args[maxArgs];
int numArgs, i;
int lastAbortCheck;
+ GooTimer *timer;
// scan a sequence of objects
updateLevel = lastAbortCheck = 0;
@@ -548,7 +553,32 @@
printf("\n");
fflush(stdout);
}
+ if (profileCommands)
+ timer = new GooTimer ();
+
+ // Run the operation
execOp(&obj, args, numArgs);
+
+ // Update the profile information
+ if (profileCommands) {
+ GooHash *hash;
+
+ hash = out->getProfileHash ();
+ if (hash) {
+ GooString *cmd_g;
+ ProfileData *data_p;
+
+ cmd_g = new GooString (obj.getCmd());
+ data_p = (ProfileData *)hash->lookup (cmd_g);
+ if (data_p == NULL) {
+ data_p = new ProfileData();
+ hash->add (cmd_g, data_p);
+ }
+
+ data_p->addElement (timer->getElapsed ());
+ }
+ delete (timer);
+ }
obj.free();
for (i = 0; i < numArgs; ++i)
args[i].free();
Index: Gfx.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Gfx.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Gfx.h 3 Mar 2005 19:46:00 -0000 1.1.1.1
+++ Gfx.h 23 Aug 2005 18:20:45 -0000 1.2
@@ -133,6 +133,7 @@
OutputDev *out; // output device
GBool subPage; // is this a sub-page object?
GBool printCommands; // print the drawing commands (for debugging)
+ GBool profileCommands; // profile the drawing commands (for debugging)
GfxResources *res; // resource stack
int updateLevel;
Index: GlobalParams.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/GlobalParams.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- GlobalParams.cc 28 Jul 2005 20:53:36 -0000 1.7
+++ GlobalParams.cc 23 Aug 2005 18:20:45 -0000 1.8
@@ -215,6 +215,7 @@
movieCommand = NULL;
mapNumericCharNames = gTrue;
printCommands = gFalse;
+ profileCommands = gFalse;
errQuiet = gFalse;
cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
@@ -1421,6 +1422,15 @@
return p;
}
+GBool GlobalParams::getProfileCommands() {
+ GBool p;
+
+ lockGlobalParams;
+ p = profileCommands;
+ unlockGlobalParams;
+ return p;
+}
+
GBool GlobalParams::getErrQuiet() {
GBool q;
@@ -1720,6 +1730,12 @@
unlockGlobalParams;
}
+void GlobalParams::setProfileCommands(GBool profileCommandsA) {
+ lockGlobalParams;
+ profileCommands = profileCommandsA;
+ unlockGlobalParams;
+}
+
void GlobalParams::setErrQuiet(GBool errQuietA) {
lockGlobalParams;
errQuiet = errQuietA;
Index: GlobalParams.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/GlobalParams.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- GlobalParams.h 28 Jul 2005 17:34:19 -0000 1.2
+++ GlobalParams.h 23 Aug 2005 18:20:45 -0000 1.3
@@ -157,6 +157,7 @@
GooString *getMovieCommand() { return movieCommand; }
GBool getMapNumericCharNames();
GBool getPrintCommands();
+ GBool getProfileCommands();
GBool getErrQuiet();
CharCodeToUnicode *getCIDToUnicode(GooString *collection);
@@ -194,6 +195,7 @@
GBool setAntialias(char *s);
void setMapNumericCharNames(GBool map);
void setPrintCommands(GBool printCommandsA);
+ void setProfileCommands(GBool profileCommandsA);
void setErrQuiet(GBool errQuietA);
private:
@@ -284,6 +286,7 @@
GooString *movieCommand; // command executed for movie annotations
GBool mapNumericCharNames; // map numeric char names (from font subsets)?
GBool printCommands; // print the drawing commands
+ GBool profileCommands; // profile the drawing commands
GBool errQuiet; // suppress error messages?
CharCodeToUnicodeCache *cidToUnicodeCache;
Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 21 Aug 2005 23:14:04 -0000 1.10
+++ Makefile.am 23 Aug 2005 18:20:45 -0000 1.11
@@ -128,6 +128,7 @@
Parser.h \
PDFDoc.h \
PDFDocEncoding.h \
+ ProfileData.h \
PSTokenizer.h \
Stream-CCITT.h \
Stream.h \
@@ -180,6 +181,7 @@
Parser.cc \
PDFDoc.cc \
PDFDocEncoding.cc \
+ ProfileData.cc \
PSTokenizer.cc \
Stream.cc \
UnicodeMap.cc \
Index: OutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/OutputDev.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- OutputDev.cc 3 Mar 2005 19:46:03 -0000 1.1.1.1
+++ OutputDev.cc 23 Aug 2005 18:20:45 -0000 1.2
@@ -17,6 +17,7 @@
#include "Stream.h"
#include "GfxState.h"
#include "OutputDev.h"
+#include "goo/GooHash.h"
//------------------------------------------------------------------------
// OutputDev
@@ -102,3 +103,19 @@
void OutputDev::opiEnd(GfxState *state, Dict *opiDict) {
}
#endif
+
+void OutputDev::startProfile() {
+ if (profileHash)
+ delete profileHash;
+
+ profileHash = new GooHash (true);
+}
+
+GooHash *OutputDev::endProfile() {
+ GooHash *profile = profileHash;
+
+ profileHash = NULL;
+
+ return profile;
+}
+
Index: OutputDev.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/OutputDev.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- OutputDev.h 3 Mar 2005 19:46:01 -0000 1.1.1.1
+++ OutputDev.h 23 Aug 2005 18:20:45 -0000 1.2
@@ -17,6 +17,7 @@
#include "goo/gtypes.h"
#include "CharTypes.h"
+class GooHash;
class GooString;
class Object;
class GfxState;
@@ -34,7 +35,7 @@
public:
// Constructor.
- OutputDev() {}
+ OutputDev() { profileHash = NULL; }
// Destructor.
virtual ~OutputDev() {}
@@ -153,10 +154,17 @@
//----- PostScript XObjects
virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
+ //----- Profiling
+ virtual void startProfile();
+ virtual GooHash *getProfileHash() {return profileHash; }
+ virtual GooHash *endProfile();
+
+
private:
double defCTM[6]; // default coordinate transform matrix
double defICTM[6]; // inverse of default CTM
+ GooHash *profileHash;
};
#endif
--- NEW FILE: ProfileData.cc ---
//========================================================================
//
// ProfileData.cc
//
// Copyright 2005 Jonathan Blandford <jrb at gnome.org>
//
//========================================================================
#include <config.h>
#ifdef USE_GCC_PRAGMAS
#pragma implementation
#endif
#include <stdlib.h>
#include <stddef.h>
#include "ProfileData.h"
//------------------------------------------------------------------------
// ProfileData
//------------------------------------------------------------------------
ProfileData::ProfileData() {
count = 0;
total = 0.0;
min = 0.0;
max = 0.0;
}
void
ProfileData::addElement (double elapsed) {
if (count == 0) {
min = elapsed;
max = elapsed;
} else {
if (elapsed < min)
min = elapsed;
if (elapsed > max)
max = elapsed;
}
total += elapsed;
count ++;
}
--- NEW FILE: ProfileData.h ---
//========================================================================
//
// ProfileData.h
//
// Copyright 2005 Jonathan Blandford <jrb at gnome.org>
//
//========================================================================
#ifndef PROFILE_DATA_H
#define PROFILE_DATA_H
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
//------------------------------------------------------------------------
// ProfileData
//------------------------------------------------------------------------
class ProfileData {
public:
// Constructor.
ProfileData ();
// Destructor.
~ProfileData() {}
void addElement (double elapsed);
int getCount () { return count; }
double getTotal () { return total; }
double getMin () { return max; }
double getMax () { return max; }
private:
int count; // size of <elems> array
double total; // number of elements in array
double min; // reference count
double max; // reference count
};
#endif
- Previous message: [poppler] poppler/test: Makefile.am, 1.1.1.1, 1.2 pdf-inspector.cc,
NONE, 1.1 pdf-inspector.glade, NONE, 1.1 pdf-operators.c, NONE, 1.1
- Next message: [poppler] poppler/test: Makefile.am,1.1.1.1,1.1.1.1.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the poppler
mailing list