Changeset 7537 for trunk/src


Ignore:
Timestamp:
Dec 3, 2001, 2:13:06 PM (24 years ago)
Author:
phaller
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/odinprof/profiler.cpp

    r7427 r7537  
    1 /* $Id: profiler.cpp,v 1.3 2001-11-22 13:35:42 phaller Exp $ */
     1/* $Id: profiler.cpp,v 1.4 2001-12-03 13:13:06 phaller Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    8181
    8282
     83#define NUM_RECORDS 256
    8384typedef struct tagThreadProfilerDataBlock
    8485{
    8586  unsigned long ulCalldepth;         // current call depth
    86   unsigned long ret[384];            // last saved return address
    87   unsigned long callStack[384];      // call stack (CS:) EIP records
    88   unsigned long enterTimeHi[384];    // machine timestamps of function entry
    89   unsigned long enterTimeLo[384];
     87  unsigned long ret[NUM_RECORDS];            // last saved return address
     88  unsigned long callStack[NUM_RECORDS];      // call stack (CS:) EIP records
     89  unsigned long enterTimeHi[NUM_RECORDS];    // machine timestamps of function entry
     90  unsigned long enterTimeLo[NUM_RECORDS];
     91  unsigned long overheadTimeHi[NUM_RECORDS]; // machine timestamps of function entry
     92  unsigned long overheadTimeLo[NUM_RECORDS];
    9093 
    9194  // Hashtable to record the PROFILEENTRY records
     
    507510  SetFS(sel);
    508511 
     512  // save overhead "timestamp"
     513  pPB->overheadTimeHi[i] = time_hi;
     514  pPB->overheadTimeLo[i] = time_lo;
     515 
    509516  // get "compensated" timestamp
    510517  // -> keep the time between entering the function and
     
    538545  ULONG eip_function = pPB->callStack[i];
    539546  PPROFILEENTRY pPE = (PPROFILEENTRY) pPB->pHashtable->getElement(eip_function);
     547 
     548  // get another overhead timestamp
     549  ULONG ulOverheadHi;
     550  ULONG ulOverheadLo;
     551  _ProfileGetTimestamp(&ulOverheadHi,
     552                       &ulOverheadLo);
     553 
     554  // If we're the lowest method on the call stack, the timing is accurate.
     555  // If we came back from a subsequent call, we have to compensate the
     556  // acumulated time of the lower-level calls and pass it up to the
     557  // previous caller.
     558 
     559  // lowest caller?
     560  if (pPB->overheadTimeLo[i] != 0)
     561  {
     562    // No -> got to compensate
     563  }
     564 
     565  // calculate and save time difference spent in profiler
     566 
    540567  if (pPE)
    541568  {
Note: See TracChangeset for help on using the changeset viewer.