scheduler: profiler: Use nanosecond as a main time unit
This commit is contained in:
@@ -55,7 +55,7 @@ Profiler::Profiler()
|
||||
void
|
||||
Profiler::EnterFunction(int32 cpu, const char* functionName)
|
||||
{
|
||||
bigtime_t start = system_time();
|
||||
nanotime_t start = system_time_nsecs();
|
||||
|
||||
FunctionData* function = _FindFunction(functionName);
|
||||
if (function == NULL)
|
||||
@@ -72,7 +72,7 @@ Profiler::EnterFunction(int32 cpu, const char* functionName)
|
||||
stackEntry->fEntryTime = start;
|
||||
stackEntry->fOthersTime = 0;
|
||||
|
||||
bigtime_t stop = system_time();
|
||||
nanotime_t stop = system_time_nsecs();
|
||||
stackEntry->fProfilerTime = stop - start;
|
||||
}
|
||||
|
||||
@@ -80,27 +80,27 @@ Profiler::EnterFunction(int32 cpu, const char* functionName)
|
||||
void
|
||||
Profiler::ExitFunction(int32 cpu, const char* functionName)
|
||||
{
|
||||
bigtime_t start = system_time();
|
||||
nanotime_t start = system_time_nsecs();
|
||||
|
||||
ASSERT(fFunctionStackPointers[cpu] > 0);
|
||||
fFunctionStackPointers[cpu]--;
|
||||
FunctionEntry* stackEntry
|
||||
= &fFunctionStacks[cpu][fFunctionStackPointers[cpu]];
|
||||
|
||||
bigtime_t timeSpent = start - stackEntry->fEntryTime;
|
||||
nanotime_t timeSpent = start - stackEntry->fEntryTime;
|
||||
timeSpent -= stackEntry->fProfilerTime;
|
||||
|
||||
atomic_add64(&stackEntry->fFunction->fTimeInclusive, timeSpent);
|
||||
atomic_add64(&stackEntry->fFunction->fTimeExclusive,
|
||||
timeSpent - stackEntry->fOthersTime);
|
||||
|
||||
bigtime_t profilerTime = stackEntry->fProfilerTime;
|
||||
nanotime_t profilerTime = stackEntry->fProfilerTime;
|
||||
if (fFunctionStackPointers[cpu] > 0) {
|
||||
stackEntry = &fFunctionStacks[cpu][fFunctionStackPointers[cpu] - 1];
|
||||
stackEntry->fOthersTime += timeSpent;
|
||||
stackEntry->fProfilerTime += profilerTime;
|
||||
|
||||
bigtime_t stop = system_time();
|
||||
nanotime_t stop = system_time_nsecs();
|
||||
stackEntry->fProfilerTime += stop - start;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ Profiler::DumpTimeInclusive(uint32 maxCount)
|
||||
uint32 count = _FunctionCount();
|
||||
|
||||
qsort(fFunctionData, count, sizeof(FunctionData),
|
||||
&_CompareFunctions<bigtime_t, &FunctionData::fTimeInclusive>);
|
||||
&_CompareFunctions<nanotime_t, &FunctionData::fTimeInclusive>);
|
||||
|
||||
if (maxCount > 0)
|
||||
count = std::min(count, maxCount);
|
||||
@@ -140,7 +140,7 @@ Profiler::DumpTimeExclusive(uint32 maxCount)
|
||||
uint32 count = _FunctionCount();
|
||||
|
||||
qsort(fFunctionData, count, sizeof(FunctionData),
|
||||
&_CompareFunctions<bigtime_t, &FunctionData::fTimeExclusive>);
|
||||
&_CompareFunctions<nanotime_t, &FunctionData::fTimeExclusive>);
|
||||
|
||||
if (maxCount > 0)
|
||||
count = std::min(count, maxCount);
|
||||
@@ -154,7 +154,7 @@ Profiler::DumpTimeInclusivePerCall(uint32 maxCount)
|
||||
uint32 count = _FunctionCount();
|
||||
|
||||
qsort(fFunctionData, count, sizeof(FunctionData),
|
||||
&_CompareFunctionsPerCall<bigtime_t, &FunctionData::fTimeInclusive>);
|
||||
&_CompareFunctionsPerCall<nanotime_t, &FunctionData::fTimeInclusive>);
|
||||
|
||||
if (maxCount > 0)
|
||||
count = std::min(count, maxCount);
|
||||
@@ -168,7 +168,7 @@ Profiler::DumpTimeExclusivePerCall(uint32 maxCount)
|
||||
uint32 count = _FunctionCount();
|
||||
|
||||
qsort(fFunctionData, count, sizeof(FunctionData),
|
||||
&_CompareFunctionsPerCall<bigtime_t, &FunctionData::fTimeExclusive>);
|
||||
&_CompareFunctionsPerCall<nanotime_t, &FunctionData::fTimeExclusive>);
|
||||
|
||||
if (maxCount > 0)
|
||||
count = std::min(count, maxCount);
|
||||
|
||||
@@ -55,9 +55,9 @@ private:
|
||||
struct FunctionEntry {
|
||||
FunctionData* fFunction;
|
||||
|
||||
bigtime_t fEntryTime;
|
||||
bigtime_t fOthersTime;
|
||||
bigtime_t fProfilerTime;
|
||||
nanotime_t fEntryTime;
|
||||
nanotime_t fOthersTime;
|
||||
nanotime_t fProfilerTime;
|
||||
};
|
||||
|
||||
uint32 _FunctionCount() const;
|
||||
|
||||
Reference in New Issue
Block a user