Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Tools/Xabsl2/GT/GTXabsl2Profiler/GTXabsl2Profiler.h

Go to the documentation of this file.

    00001 /**
    00002 * @file GTXabsl2Profiler.h
    00003 *
    00004 * Definition and Implementation of classes GTXabsl2Profiler, GTXabsl2ProfilerNameTable
    00005 *
    00006 * @author Michael Spranger
    00007 */
    00008 #ifndef __GTXabsl2Profiler_h_
    00009 #define __GTXabsl2Profiler_h_
    00010
    00011 #ifdef _WIN32
    00012 #pragma warning(disable:4786)
    00013 // the constructor with all it's long parameter type names results in a too
    00014 // long debug identifier
    00015 #endif
    00016
    00017 #include <string>
    00018 #include <vector>
    00019 #include <deque>
    00020
    00021 #include "Platform/GTAssert.h"
    00022
    00023 #include "Tools/Streams/OutStreams.h"
    00024 #include "Platform/SystemCall.h"
    00025
    00026
    00027 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2Engine.h"
    00028 #include "Tools/Debugging/Debugging.h"
    00029
    00030 #include "Tools/Streams/InStreams.h"
    00031 #include "Tools/Module/SolutionRequest.h"
    00032
    00033 #include "GTXabsl2ProfilerLog.h"
    00034
    00035 /* Nr of Logelements written out per call to writeLog */
    00036 #define NROFELEMW 2
    00037
    00038
    00039 /**
    00040 * @class GTXabsl2Profiler
    00041 * Class for profiling and analysis of Xabsl-Activation-Paths
    00042 * @author Michael Spranger
    00043 */
    00044 class GTXabsl2Profiler
    00045 {
    00046 private:
    00047
    00048   /** Name of the file the Log is written to */
    00049   std::string logFileName;
    00050
    00051   /** A reference to a variable containing the current frame number */
    00052   const unsigned long* frameNumber;
    00053
    00054 public:
    00055
    00056   /** The log. */
    00057   GTXabsl2Log log;
    00058
    00059   /** The Xabsl-Output-Symbols for the Profiler */
    00060   enum { dontCollectProfiles, collectProfiles} profilerCollectMode;
    00061   enum { dontWriteProfiles, writeProfiles, writeCompleteProfiles} profilerWriteMode;
    00062
    00063   /*
    00064    * Called by Xabls-Engine to make profiler symbols visible to behavior
    00065    */
    00066   void registerSymbols(Xabsl2Engine&);
    00067
    00068   GTXabsl2Profiler();
    00069   /** Constructor
    00070   * @param id The id of the observed xabsl engine
    00071   * @param frameNumber A reference to the frame number
    00072   */
    00073   GTXabsl2Profiler(SolutionRequest::xabsl2EngineID id,
    00074       const unsigned long* frameNumber);
    00075
    00076   /*
    00077    *  Initialises Engine, creates nametable and writes it to logFileName
    00078    * @param pEnginge Reference to the engine to be profiled
    00079    */
    00080   void init(Xabsl2Engine& pEngine);
    00081
    00082   /*
    00083    * Runs through the Engine determine active options, states and their parameters, writes the option-activation-path to log
    00084    * @param pEngine XabslEngine to be profiled
    00085    */
    00086   void recordLog(Xabsl2Engine& pEngine);
    00087
    00088   /*
    00089    * Write a certain number (NROFELEMW) of logs to logFileName, erasing them from the log.
    00090    */
    00091   void writeLogEntriesToFileAndRemove(int numberOfLogs = 2);
    00092
    00093   /*
    00094    * Writes the complete log to logFileName, erasing all up to now collected logs.
    00095    */
    00096   void writeCompleteLogToFileAndClear();
    00097
    00098 };
    00099
    00100 #endif// __GTXabsl2Profiler_h_
    00101