- Timestamp:
- Dec 3, 2001, 2:13:06 PM (24 years ago)
- 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:42phaller Exp $ */1 /* $Id: profiler.cpp,v 1.4 2001-12-03 13:13:06 phaller Exp $ */ 2 2 /* 3 3 * Project Odin Software License can be found in LICENSE.TXT … … 81 81 82 82 83 #define NUM_RECORDS 256 83 84 typedef struct tagThreadProfilerDataBlock 84 85 { 85 86 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]; 90 93 91 94 // Hashtable to record the PROFILEENTRY records … … 507 510 SetFS(sel); 508 511 512 // save overhead "timestamp" 513 pPB->overheadTimeHi[i] = time_hi; 514 pPB->overheadTimeLo[i] = time_lo; 515 509 516 // get "compensated" timestamp 510 517 // -> keep the time between entering the function and … … 538 545 ULONG eip_function = pPB->callStack[i]; 539 546 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 540 567 if (pPE) 541 568 {
Note:
See TracChangeset
for help on using the changeset viewer.