Update of /cvsroot/javaprofiler/library/src/calltree In directory usw-pr-cvs1:/tmp/cvs-serv27034/src/calltree Added Files: Makefile Makefile.mak Makefile.rules callTree.cpp callTree.h callTreeItem.cpp callTreeItem.h dir.info Log Message: calltree --- NEW FILE: Makefile --- include ../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- callTree.o \ callTree.obj: callTree.cpp $(CCC) $(CPPFLAGS) callTree.cpp callTreeItem.o \ callTreeItem.obj: callTreeItem.cpp $(CCC) $(CPPFLAGS) callTreeItem.cpp --- NEW FILE: callTree.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../calltree/callTree.h" CallTree::~CallTree(){ while( root) { while( root) { current = root; root = root->children.first(); } root = current->parent; if( root) root->children.remove( current)->destroy(); } if( current) current->destroy(); } void CallTree::getBinaryData( Buffer& b) { CallTreeItem* p = root; CallTreeItem* q = NULL; while( 1) { while( p) { p->getBinaryData( b); q = p; p = p->children.first(); } if( q) p = q->parent; if( !p) break; CallTreeItem* r = p->children.next( q); q = p; p = r; } } --- NEW FILE: callTree.h --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #ifndef _CALLTREE_H_ #define _CALLTREE_H_ #include "../calltree/callTreeItem.h" #include "../commun/buffer.h" /** CallTree of the thread. Java methods are called in given ** Java thread and on the base of the stack of these calls ** we can construct a tree - a calltree. This calltree shows ** us how a method calls another methods and how these methods ** call anothers etc. Using this tree we can easily compute and ** show cumulative and pure time, call stack etc. This class only ** encapsulates a list of CallTreeItem objects. ** ** @see CallTreeItem, Thread ** ** @author Marek Przeczek */ class CallTree { public: /// root of the calltree (first method called in the thread) CallTreeItem* root; /// current method (just called and running) CallTreeItem* current; public: /// Default constructor. CallTree() : root( NULL), current( NULL) {} /// Destructor. ~CallTree(); public: /** Get binary data. This method adds the whole calltree ** to the end of output buffer 'b' - in binary format ** appropriate eg. for transfer to client. ** ** @param b reference to output buffer */ void getBinaryData( Buffer& b); }; #endif // _CALLTREE_H_ --- NEW FILE: callTreeItem.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../calltree/callTreeItem.h" #include "../shared/method.h" #ifdef USE_ALLOCATOR Allocator CallTreeItem::_allocator; #endif void CallTreeItem::getBinaryData( Buffer& b) { b += cumulativeTime; b += hits; b += pureTime; b += method->getProfID(); b += method->getProfID(); b += (jint)children.length(); } --- NEW FILE: callTreeItem.h --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #ifndef _CALLTREE_ITEM_H_ #define _CALLTREE_ITEM_H_ #include "../list/listItem.h" #include "../main/includes.h" #include "../list/list.h" #include "../allocator/allocator.h" #include "../commun/buffer.h" /** An item of the calltree. This class describes ** one item of the calltree. It contains all data ** which are required and possible to gain. ** One CallTreeItem corresponds to one method ** in the call stack trace for given thread. ** ** @see CallTree ** ** @author Marek Przeczek */ class CallTreeItem: public LI1 { public: /// last time when a method was entered jlong startTime; public: /// time spent in the method (including sub-calls) jlong cumulativeTime; /// number of calls of the method jlong hits; /// time spent in the method (excluding sub-calls) jlong pureTime; public: /// information about the method Method* method; public: /// parent in the tree (method who called this one) CallTreeItem* parent; /// methods called by this method List<CallTreeItem, LI1> children; public: /// Default constructor. CallTreeItem() : startTime( 0), cumulativeTime( 0), hits( 0), pureTime( 0), method( NULL), parent( NULL) {} /// Destructor. virtual ~CallTreeItem() {} #ifdef USE_ALLOCATOR private: /// allocator static Allocator _allocator; public: /** Overloaded new() operator. */ void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} #endif public: /** Get binary data. This method adds all necessary data ** to the end of buffer 'b' in binary format which can ** then be used eg. for transfer to client. ** ** @param b reference to output buffer */ void getBinaryData( Buffer& b); }; #endif // _CALLTREE_ITEM_H_ --- NEW FILE: dir.info --- FILES = callTree callTreeItem CLEAN_FILES = *.pdb *.obj *.o |