* The system profiler scheduling event structures sport nanotime_ts now.

* Adjusted the DebugAnalyzer to handle nanosecond times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34546 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-12-07 22:56:29 +00:00
parent b2a2d5c065
commit d8d4b902cb
23 changed files with 454 additions and 208 deletions

View File

@ -5,6 +5,7 @@
#ifndef _SYSTEM_SYSTEM_PROFILER_DEFS_H
#define _SYSTEM_SYSTEM_PROFILER_DEFS_H
#include <image.h>
@ -130,13 +131,13 @@ struct system_profiler_samples {
// base structure for the following three
struct system_profiler_thread_scheduling_event {
bigtime_t time;
nanotime_t time;
thread_id thread;
};
// B_SYSTEM_PROFILER_THREAD_SCHEDULED
struct system_profiler_thread_scheduled {
bigtime_t time;
nanotime_t time;
thread_id thread;
thread_id previous_thread;
uint16 previous_thread_state;
@ -146,14 +147,14 @@ struct system_profiler_thread_scheduled {
// B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE
struct system_profiler_thread_enqueued_in_run_queue {
bigtime_t time;
nanotime_t time;
thread_id thread;
uint8 priority;
};
// B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE
struct system_profiler_thread_removed_from_run_queue {
bigtime_t time;
nanotime_t time;
thread_id thread;
};

View File

@ -9,31 +9,7 @@
#include "chart/ChartDataRange.h"
#include "chart/StringChartLegend.h"
struct decomposed_time {
bigtime_t hours;
int minutes;
int seconds;
int micros;
};
static void
decompose_time(bigtime_t time, decomposed_time& decomposed)
{
// microsecs
decomposed.micros = time % 1000000;
time /= 1000000;
// secs
decomposed.seconds = time % 60;
time /= 60;
// mins
decomposed.minutes = time % 60;
time /= 60;
// hours
decomposed.hours = time;
}
#include "util/TimeUtils.h"
int32
@ -80,7 +56,7 @@ BigtimeChartAxisLegendSource::GetAxisLegends(const ChartDataRange& range,
bigtime_t interval = baseInterval * relativeFactor;
bigtime_t time = (startTime + interval - 1) / interval * interval;
for (; time <= endTime; time += interval) {
decomposed_time decomposed;
decomposed_bigtime decomposed;
decompose_time(time, decomposed);
char buffer[128];
snprintf(buffer, sizeof(buffer), "%02lld:%02d:%02d.%06d",

View File

@ -19,5 +19,6 @@ MergeObject DebugAnalyzer_gui_chart.o
DefaultChartAxisLegendSource.cpp
LegendChartAxis.cpp
LineChartRenderer.cpp
NanotimeChartAxisLegendSource.cpp
StringChartLegend.cpp
;

View File

@ -0,0 +1,79 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "chart/NanotimeChartAxisLegendSource.h"
#include <stdio.h>
#include "chart/ChartDataRange.h"
#include "chart/StringChartLegend.h"
#include "util/TimeUtils.h"
int32
NanotimeChartAxisLegendSource::GetAxisLegends(const ChartDataRange& range,
ChartLegend** legends, double* values, int32 maxLegends)
{
// interpret range as time range
nanotime_t startTime = (nanotime_t)range.min;
nanotime_t endTime = (nanotime_t)range.max;
// TODO: Handle sub-nanosecs ranges!
if (startTime >= endTime)
return 0;
nanotime_t positionFactors[4];
positionFactors[3] = 1;
positionFactors[2] = 1000000000;
positionFactors[1] = positionFactors[2] * 60;
positionFactors[0] = positionFactors[1] * 60;
// find the main position (h, m, s, us) we want to play with
int32 position = 0;
nanotime_t rangeTime = endTime - startTime;
while (rangeTime / positionFactors[position] + 1 < maxLegends / 2
&& position < 3) {
position++;
}
// adjust the factor so that we get maxLegends / 2 to maxLegends legends
nanotime_t baseInterval = positionFactors[position];
nanotime_t relativeFactor = 1;
while (rangeTime / (baseInterval * relativeFactor) >= maxLegends) {
if (relativeFactor == 1) {
relativeFactor = 2;
} else if (relativeFactor == 2) {
relativeFactor = 5;
} else if (relativeFactor == 5) {
baseInterval *= 10;
relativeFactor = 1;
}
}
// generate the legends
int32 count = 0;
nanotime_t interval = baseInterval * relativeFactor;
nanotime_t time = (startTime + interval - 1) / interval * interval;
for (; time <= endTime; time += interval) {
decomposed_nanotime decomposed;
decompose_time(time, decomposed);
char buffer[128];
snprintf(buffer, sizeof(buffer), "%02lld:%02d:%02d.%09d",
decomposed.hours, decomposed.minutes, decomposed.seconds,
decomposed.nanos);
// TODO: Drop superfluous nanoseconds digits, or even nanoseconds and seconds
// completely.
StringChartLegend* legend
= new(std::nothrow) StringChartLegend(buffer, 1);
if (legend == NULL)
return count;
legends[count] = legend;
values[count++] = (double)time;
}
return count;
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef NANOTIME_CHART_AXIS_LEGEND_SOURCE_H
#define NANOTIME_CHART_AXIS_LEGEND_SOURCE_H
#include "chart/ChartAxisLegendSource.h"
class NanotimeChartAxisLegendSource : public ChartAxisLegendSource {
public:
virtual int32 GetAxisLegends(const ChartDataRange& range,
ChartLegend** legends, double* values,
int32 maxLegends);
};
#endif // NANOTIME_CHART_AXIS_LEGEND_SOURCE_H

View File

@ -7,6 +7,8 @@
#include <stdio.h>
#include "util/TimeUtils.h"
MainWindow::GeneralPage::GeneralPage()
:
@ -43,8 +45,8 @@ MainWindow::GeneralPage::SetModel(Model* model)
// run time
char buffer[128];
snprintf(buffer, sizeof(buffer), "%lld μs", fModel->LastEventTime());
fRunTimeView->SetText(buffer);
fRunTimeView->SetText(format_nanotime(fModel->LastEventTime(), buffer,
sizeof(buffer)));
// team count
snprintf(buffer, sizeof(buffer), "%ld", fModel->CountTeams());

View File

@ -22,7 +22,7 @@
#include "Array.h"
#include "chart/BigtimeChartAxisLegendSource.h"
#include "chart/NanotimeChartAxisLegendSource.h"
#include "chart/LegendChartAxis.h"
#include "chart/StringChartLegend.h"
#include "HeaderView.h"
@ -34,11 +34,11 @@ static const float kViewSeparationMargin = 5.0f;
struct MainWindow::SchedulingPage::SchedulingEvent {
bigtime_t time;
nanotime_t time;
Model::ThreadWaitObjectGroup* waitObject;
ThreadState state;
SchedulingEvent(bigtime_t time, ThreadState state,
SchedulingEvent(nanotime_t time, ThreadState state,
Model::ThreadWaitObjectGroup* waitObject)
:
time(time),
@ -95,7 +95,7 @@ public:
return fDataArrays[index];
}
void AddState(Model::Thread* thread, bigtime_t time, ThreadState state,
void AddState(Model::Thread* thread, nanotime_t time, ThreadState state,
Model::ThreadWaitObjectGroup* waitObject)
{
DataArray& array = fDataArrays[thread->Index()];
@ -117,28 +117,28 @@ public:
array.Add(event);
}
void AddRun(Model::Thread* thread, bigtime_t time)
void AddRun(Model::Thread* thread, nanotime_t time)
{
AddState(thread, time, RUNNING, NULL);
}
void AddLatency(Model::Thread* thread, bigtime_t time)
void AddLatency(Model::Thread* thread, nanotime_t time)
{
AddState(thread, time, READY, NULL);
}
void AddPreemption(Model::Thread* thread, bigtime_t time)
void AddPreemption(Model::Thread* thread, nanotime_t time)
{
AddState(thread, time, PREEMPTED, NULL);
}
void AddWait(Model::Thread* thread, bigtime_t time,
void AddWait(Model::Thread* thread, nanotime_t time,
Model::ThreadWaitObjectGroup* waitObject)
{
AddState(thread, time, WAITING, waitObject);
}
void AddUnspecifiedWait(Model::Thread* thread, bigtime_t time)
void AddUnspecifiedWait(Model::Thread* thread, nanotime_t time)
{
AddState(thread, time, WAITING, NULL);
}
@ -154,10 +154,10 @@ private:
struct MainWindow::SchedulingPage::TimeRange : BReferenceable {
bigtime_t startTime;
bigtime_t endTime;
nanotime_t startTime;
nanotime_t endTime;
TimeRange(bigtime_t startTime, bigtime_t endTime)
TimeRange(nanotime_t startTime, nanotime_t endTime)
:
startTime(startTime),
endTime(endTime)
@ -171,7 +171,7 @@ class MainWindow::SchedulingPage::TimelineHeaderRenderer
public:
TimelineHeaderRenderer()
:
fAxis(new BigtimeChartAxisLegendSource, new StringChartLegendRenderer)
fAxis(new NanotimeChartAxisLegendSource, new StringChartLegendRenderer)
{
fAxis.SetLocation(CHART_AXIS_TOP);
}
@ -367,14 +367,14 @@ public:
}
}
void GetDataRange(bigtime_t& _startTime, bigtime_t& _endTime)
void GetDataRange(nanotime_t& _startTime, nanotime_t& _endTime)
{
_GetEventTimeRange(_startTime, _endTime);
}
virtual BSize MinSize()
{
bigtime_t timeSpan = fModel != NULL ? fModel->LastEventTime() : 0;
nanotime_t timeSpan = fModel != NULL ? fModel->LastEventTime() : 0;
float width = std::max(float(timeSpan / fUSecsPerPixel), 100.0f);
return BSize(width, TotalHeight());
}
@ -446,8 +446,8 @@ public:
//printf("drawing events for thread %ld: %ld events\n", thread->Index(), eventCount);
for (int32 k = 0; k < eventCount; k++) {
const SchedulingEvent& event = events[k];
bigtime_t startTime = std::max(event.time, fStartTime);
bigtime_t endTime = k + 1 < eventCount
nanotime_t startTime = std::max(event.time, fStartTime);
nanotime_t endTime = k + 1 < eventCount
? std::min(events[k + 1].time, fEndTime) : fEndTime;
rgb_color color;
@ -488,8 +488,8 @@ private:
void _UpdateData()
{
// get the interesting event time range
bigtime_t startTime;
bigtime_t endTime;
nanotime_t startTime;
nanotime_t endTime;
_GetEventTimeRange(startTime, endTime);
if (startTime == fStartTime && endTime == fEndTime)
@ -593,12 +593,12 @@ printf("failed to read event!\n");
}
}
void _GetEventTimeRange(bigtime_t& _startTime, bigtime_t& _endTime)
void _GetEventTimeRange(nanotime_t& _startTime, nanotime_t& _endTime)
{
if (fModel != NULL) {
float scrollOffset = _ScrollOffset();
_startTime = (bigtime_t)scrollOffset * fUSecsPerPixel;
_endTime = (bigtime_t)(scrollOffset + Bounds().Width() + 1)
_startTime = (nanotime_t)scrollOffset * fUSecsPerPixel;
_endTime = (nanotime_t)(scrollOffset + Bounds().Width() + 1)
* fUSecsPerPixel;
} else {
_startTime = 0;
@ -652,7 +652,7 @@ printf("failed to read event!\n");
}
}
inline void _UpdateLastEventTime(bigtime_t time)
inline void _UpdateLastEventTime(nanotime_t time)
{
fState.SetLastEventTime(time - fModel->BaseTime());
}
@ -834,7 +834,7 @@ return B_BAD_DATA;
thread->state = STILL_RUNNING;
} else {
// Thread was waiting and is ready now.
bigtime_t diffTime = fState.LastEventTime() - thread->lastTime;
nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
if (thread->waitObject != NULL) {
thread->waitObject->AddWait(diffTime);
thread->waitObject = NULL;
@ -870,8 +870,8 @@ return B_BAD_DATA;
private:
Model::SchedulingState fState;
SchedulingData fSchedulingData;
bigtime_t fStartTime;
bigtime_t fEndTime;
nanotime_t fStartTime;
nanotime_t fEndTime;
uint32 fUSecsPerPixel;
BPoint fLastMousePos;
Listener* fListener;
@ -996,8 +996,8 @@ private:
if (header == NULL)
return;
bigtime_t startTime;
bigtime_t endTime;
nanotime_t startTime;
nanotime_t endTime;
fSchedulingView->GetDataRange(startTime, endTime);
TimeRange* range = new(std::nothrow) TimeRange(startTime, endTime);
if (range != NULL) {

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include "main_window/TeamsPage.h"
#include <stdio.h>
@ -82,9 +83,9 @@ MainWindow::TeamsPage::TeamsPage(MainWindow* parent)
B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fTeamsTable->AddColumn(new StringTableColumn(1, "Name", 80, 40, 1000,
B_TRUNCATE_END, B_ALIGN_LEFT));
fTeamsTable->AddColumn(new BigtimeTableColumn(2, "Creation", 80, 40, 1000,
fTeamsTable->AddColumn(new NanotimeTableColumn(2, "Creation", 80, 40, 1000,
true, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fTeamsTable->AddColumn(new BigtimeTableColumn(3, "Deletion", 80, 40, 1000,
fTeamsTable->AddColumn(new NanotimeTableColumn(3, "Deletion", 80, 40, 1000,
false, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fTeamsTable->AddTableListener(this);

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include "main_window/ThreadsPage.h"
#include <stdio.h>
@ -120,27 +121,27 @@ MainWindow::ThreadsPage::ThreadsPage(MainWindow* parent)
B_TRUNCATE_END, B_ALIGN_LEFT));
fThreadsTable->AddColumn(new StringTableColumn(2, "Team", 80, 40, 1000,
B_TRUNCATE_END, B_ALIGN_LEFT));
fThreadsTable->AddColumn(new BigtimeTableColumn(3, "Creation", 80, 40, 1000,
true, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new BigtimeTableColumn(4, "Deletion", 80, 40, 1000,
false, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new NanotimeTableColumn(3, "Creation", 80, 40,
1000, true, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new NanotimeTableColumn(4, "Deletion", 80, 40,
1000, false, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new Int64TableColumn(5, "Runs", 80, 20, 1000,
B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new BigtimeTableColumn(6, "Run Time", 80, 20, 1000,
false, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new NanotimeTableColumn(6, "Run Time", 80, 20,
1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new Int64TableColumn(7, "Latencies", 80, 20, 1000,
B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new BigtimeTableColumn(8, "Latency Time", 80, 20,
fThreadsTable->AddColumn(new NanotimeTableColumn(8, "Latency Time", 80, 20,
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new Int64TableColumn(9, "Preemptions", 80, 20,
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new BigtimeTableColumn(10, "Preemption Time", 80,
fThreadsTable->AddColumn(new NanotimeTableColumn(10, "Preemption Time", 80,
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new Int64TableColumn(11, "Waits", 80, 20,
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new BigtimeTableColumn(12, "Wait Time", 80,
fThreadsTable->AddColumn(new NanotimeTableColumn(12, "Wait Time", 80,
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddColumn(new BigtimeTableColumn(13, "Unspecified Time", 80,
fThreadsTable->AddColumn(new NanotimeTableColumn(13, "Unspecified Time", 80,
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
fThreadsTable->AddTableListener(this);

View File

@ -116,7 +116,7 @@ MainWindow::WaitObjectsPage::WaitObjectsPage(MainWindow* parent)
// 1000, B_TRUNCATE_END, B_ALIGN_LEFT));
fWaitObjectsTable->AddColumn(new Int64TableColumn(4, "Waits", 80, 40,
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
fWaitObjectsTable->AddColumn(new BigtimeTableColumn(5, "Wait Time", 80,
fWaitObjectsTable->AddColumn(new NanotimeTableColumn(5, "Wait Time", 80,
40, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
}

View File

@ -8,6 +8,8 @@
#include <stdio.h>
#include "util/TimeUtils.h"
// #pragma mark - DelegateBasedTableColumn
@ -211,16 +213,8 @@ BigtimeTableColumn::PrepareField(const BVariant& value) const
BVariant("-", B_VARIANT_DONT_COPY_DATA));
}
int micros = int(time % 1000000);
time /= 1000000;
int seconds = int(time % 60);
time /= 60;
int minutes = int(time % 60);
time /= 60;
char buffer[64];
snprintf(buffer, sizeof(buffer), "%02lld:%02d:%02d:%06d", time, minutes,
seconds, micros);
format_bigtime(time, buffer, sizeof(buffer));
return StringTableColumn::PrepareField(
BVariant(buffer, B_VARIANT_DONT_COPY_DATA));
}
@ -242,3 +236,51 @@ BigtimeTableColumn::CompareValues(const BVariant& _a, const BVariant& _b)
return a - b < 0 ? -1 : 1;
}
// #pragma mark - NanotimeTableColumn
NanotimeTableColumn::NanotimeTableColumn(int32 modelIndex, const char* title,
float width, float minWidth, float maxWidth, bool invalidFirst,
uint32 truncate, alignment align)
:
StringTableColumn(modelIndex, title, width, minWidth, maxWidth, truncate,
align),
fInvalidFirst(invalidFirst)
{
}
BField*
NanotimeTableColumn::PrepareField(const BVariant& value) const
{
nanotime_t time = value.ToInt64();
if (time < 0) {
return StringTableColumn::PrepareField(
BVariant("-", B_VARIANT_DONT_COPY_DATA));
}
char buffer[64];
format_nanotime(time, buffer, sizeof(buffer));
return StringTableColumn::PrepareField(
BVariant(buffer, B_VARIANT_DONT_COPY_DATA));
}
int
NanotimeTableColumn::CompareValues(const BVariant& _a, const BVariant& _b)
{
nanotime_t a = _a.ToInt64();
nanotime_t b = _b.ToInt64();
if (a == b)
return 0;
if (a < 0)
return fInvalidFirst ? -1 : 1;
if (b < 0)
return fInvalidFirst ? 1 : -1;
return a - b < 0 ? -1 : 1;
}

View File

@ -131,4 +131,24 @@ private:
};
class NanotimeTableColumn : public StringTableColumn {
public:
NanotimeTableColumn(int32 modelIndex,
const char* title, float width,
float minWidth, float maxWidth,
bool invalidFirst,
uint32 truncate = B_TRUNCATE_MIDDLE,
alignment align = B_ALIGN_RIGHT);
protected:
virtual BField* PrepareField(const BVariant& value) const;
virtual int CompareValues(const BVariant& a,
const BVariant& b);
private:
bool fInvalidFirst;
};
#endif // TABLE_COLUMNS_H

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include "thread_window/ActivityPage.h"
#include <new>
@ -18,7 +19,7 @@
#include "MessageCodes.h"
#include "ThreadModel.h"
#include "chart/BigtimeChartAxisLegendSource.h"
#include "chart/NanotimeChartAxisLegendSource.h"
#include "chart/Chart.h"
#include "chart/ChartDataSource.h"
#include "chart/DefaultChartAxisLegendSource.h"
@ -69,8 +70,8 @@ public:
double sampleLength = (end - start) / (double)sampleCount;
int32 startIndex = fModel->FindSchedulingEvent((bigtime_t)start);
bigtime_t baseTime = fModel->GetModel()->BaseTime();
int32 startIndex = fModel->FindSchedulingEvent((nanotime_t)start);
nanotime_t baseTime = fModel->GetModel()->BaseTime();
enum ScheduleState {
RUNNING,
@ -375,11 +376,11 @@ ThreadWindow::ActivityPage::ActivityPage()
// TODO: Allocation management...
LegendChartAxis* axis = new LegendChartAxis(
new BigtimeChartAxisLegendSource, new StringChartLegendRenderer);
new NanotimeChartAxisLegendSource, new StringChartLegendRenderer);
fActivityChart->SetAxis(CHART_AXIS_BOTTOM, axis);
axis = new LegendChartAxis(
new BigtimeChartAxisLegendSource, new StringChartLegendRenderer);
new NanotimeChartAxisLegendSource, new StringChartLegendRenderer);
fActivityChart->SetAxis(CHART_AXIS_TOP, axis);
axis = new LegendChartAxis(

View File

@ -7,6 +7,8 @@
#include <stdio.h>
#include "util/TimeUtils.h"
ThreadWindow::GeneralPage::GeneralPage()
:
@ -60,29 +62,38 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
fTeamView->SetText(thread->GetTeam()->Name());
// run time
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
fThread->TotalRunTime(), fThread->Runs());
char timeBuffer[64];
format_nanotime(fThread->TotalRunTime(), timeBuffer,
sizeof(timeBuffer));
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
fThread->Runs());
fRunTimeView->SetText(buffer);
// wait time
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
fThread->TotalWaitTime(), fThread->Waits());
format_nanotime(fThread->TotalWaitTime(), timeBuffer,
sizeof(timeBuffer));
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
fThread->Waits());
fWaitTimeView->SetText(buffer);
// latencies
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
fThread->TotalLatency(), fThread->Latencies());
format_nanotime(fThread->TotalLatency(), timeBuffer,
sizeof(timeBuffer));
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
fThread->Latencies());
fLatencyView->SetText(buffer);
// preemptions
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
fThread->TotalRerunTime(), fThread->Preemptions());
format_nanotime(fThread->TotalRerunTime(), timeBuffer,
sizeof(timeBuffer));
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
fThread->Preemptions());
fPreemptionView->SetText(buffer);
// unspecified time
snprintf(buffer, sizeof(buffer), "%lld μs",
fThread->UnspecifiedWaitTime());
fUnspecifiedTimeView->SetText(buffer);
format_nanotime(fThread->UnspecifiedWaitTime(), timeBuffer,
sizeof(timeBuffer));
fUnspecifiedTimeView->SetText(timeBuffer);
} else {
fThreadNameView->SetText("");
fThreadIDView->SetText("");

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include "thread_window/WaitObjectsPage.h"
#include <stdio.h>
@ -290,7 +291,7 @@ ThreadWindow::WaitObjectsPage::WaitObjectsPage()
1000, B_TRUNCATE_END, B_ALIGN_LEFT));
fWaitObjectsTree->AddColumn(new Int64TableColumn(4, "Waits", 80, 20,
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
fWaitObjectsTree->AddColumn(new BigtimeTableColumn(5, "Wait Time", 80,
fWaitObjectsTree->AddColumn(new NanotimeTableColumn(5, "Wait Time", 80,
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
fWaitObjectsTree->AddTreeTableListener(this);

View File

@ -32,7 +32,7 @@ Model::WaitObject::~WaitObject()
void
Model::WaitObject::AddWait(bigtime_t waitTime)
Model::WaitObject::AddWait(nanotime_t waitTime)
{
fWaits++;
fTotalWaitTime += waitTime;
@ -66,7 +66,7 @@ Model::WaitObjectGroup::Waits()
}
bigtime_t
nanotime_t
Model::WaitObjectGroup::TotalWaitTime()
{
if (fTotalWaitTime < 0)
@ -109,7 +109,7 @@ Model::ThreadWaitObject::~ThreadWaitObject()
void
Model::ThreadWaitObject::AddWait(bigtime_t waitTime)
Model::ThreadWaitObject::AddWait(nanotime_t waitTime)
{
fWaits++;
fTotalWaitTime += waitTime;
@ -150,7 +150,7 @@ Model::ThreadWaitObjectGroup::GetThreadWaitObjects(
// #pragma mark - Team
Model::Team::Team(const system_profiler_team_added* event, bigtime_t time)
Model::Team::Team(const system_profiler_team_added* event, nanotime_t time)
:
fCreationEvent(event),
fCreationTime(time),
@ -176,7 +176,7 @@ Model::Team::AddThread(Thread* thread)
Model::Thread::Thread(Team* team, const system_profiler_thread_added* event,
bigtime_t time)
nanotime_t time)
:
fTeam(team),
fCreationEvent(event),
@ -222,7 +222,7 @@ Model::Thread::ThreadWaitObjectGroupFor(uint32 type, addr_t object) const
void
Model::Thread::AddRun(bigtime_t runTime)
Model::Thread::AddRun(nanotime_t runTime)
{
fRuns++;
fTotalRunTime += runTime;
@ -235,7 +235,7 @@ Model::Thread::AddRun(bigtime_t runTime)
void
Model::Thread::AddRerun(bigtime_t runTime)
Model::Thread::AddRerun(nanotime_t runTime)
{
fReruns++;
fTotalRerunTime += runTime;
@ -248,7 +248,7 @@ Model::Thread::AddRerun(bigtime_t runTime)
void
Model::Thread::AddLatency(bigtime_t latency)
Model::Thread::AddLatency(nanotime_t latency)
{
fLatencies++;
fTotalLatency += latency;
@ -261,14 +261,14 @@ Model::Thread::AddLatency(bigtime_t latency)
void
Model::Thread::AddPreemption(bigtime_t runTime)
Model::Thread::AddPreemption(nanotime_t runTime)
{
fPreemptions++;
}
void
Model::Thread::AddWait(bigtime_t waitTime)
Model::Thread::AddWait(nanotime_t waitTime)
{
fWaits++;
fTotalWaitTime += waitTime;
@ -276,7 +276,7 @@ Model::Thread::AddWait(bigtime_t waitTime)
void
Model::Thread::AddUnspecifiedWait(bigtime_t waitTime)
Model::Thread::AddUnspecifiedWait(nanotime_t waitTime)
{
fUnspecifiedWaitTime += waitTime;
}
@ -388,7 +388,7 @@ Model::SchedulingState::Clear()
Model::CompactSchedulingState::Create(const SchedulingState& state,
off_t eventOffset)
{
bigtime_t lastEventTime = state.LastEventTime();
nanotime_t lastEventTime = state.LastEventTime();
// count the active threads
int32 threadCount = 0;
@ -475,14 +475,14 @@ Model::LoadingFinished()
void
Model::SetBaseTime(bigtime_t time)
Model::SetBaseTime(nanotime_t time)
{
fBaseTime = time;
}
void
Model::SetLastEventTime(bigtime_t time)
Model::SetLastEventTime(nanotime_t time)
{
fLastEventTime = time;
}
@ -510,7 +510,7 @@ Model::TeamByID(team_id id) const
Model::Team*
Model::AddTeam(const system_profiler_team_added* event, bigtime_t time)
Model::AddTeam(const system_profiler_team_added* event, nanotime_t time)
{
Team* team = TeamByID(event->team);
if (team != NULL) {
@ -554,7 +554,7 @@ Model::ThreadByID(thread_id id) const
Model::Thread*
Model::AddThread(const system_profiler_thread_added* event, bigtime_t time)
Model::AddThread(const system_profiler_thread_added* event, nanotime_t time)
{
// check whether we do already know the thread
Thread* thread = ThreadByID(event->thread);
@ -696,7 +696,7 @@ Model::AddSchedulingStateSnapshot(const SchedulingState& state,
const Model::CompactSchedulingState*
Model::ClosestSchedulingState(bigtime_t eventTime) const
Model::ClosestSchedulingState(nanotime_t eventTime) const
{
int32 index = fSchedulingStates.BinarySearchIndexByKey(eventTime,
&_CompareEventTimeSchedulingState);
@ -710,7 +710,7 @@ Model::ClosestSchedulingState(bigtime_t eventTime) const
/*static*/ int
Model::_CompareEventTimeSchedulingState(const bigtime_t* time,
Model::_CompareEventTimeSchedulingState(const nanotime_t* time,
const CompactSchedulingState* state)
{
if (*time < state->LastEventTime())

View File

@ -58,25 +58,25 @@ public:
void LoadingFinished();
inline bigtime_t BaseTime() const;
void SetBaseTime(bigtime_t time);
inline nanotime_t BaseTime() const;
void SetBaseTime(nanotime_t time);
inline bigtime_t LastEventTime() const;
void SetLastEventTime(bigtime_t time);
inline nanotime_t LastEventTime() const;
void SetLastEventTime(nanotime_t time);
int32 CountTeams() const;
Team* TeamAt(int32 index) const;
Team* TeamByID(team_id id) const;
Team* AddTeam(
const system_profiler_team_added* event,
bigtime_t time);
nanotime_t time);
int32 CountThreads() const;
Thread* ThreadAt(int32 index) const;
Thread* ThreadByID(thread_id id) const;
Thread* AddThread(
const system_profiler_thread_added* event,
bigtime_t time);
nanotime_t time);
WaitObject* AddWaitObject(
const system_profiler_wait_object_info*
@ -101,7 +101,7 @@ public:
off_t eventOffset);
// must be added in order (of time)
const CompactSchedulingState* ClosestSchedulingState(
bigtime_t eventTime) const;
nanotime_t eventTime) const;
// returns the closest previous state
private:
@ -111,15 +111,15 @@ private:
typedef BObjectList<CompactSchedulingState> SchedulingStateList;
private:
static int _CompareEventTimeSchedulingState(const bigtime_t* time,
static int _CompareEventTimeSchedulingState(const nanotime_t* time,
const CompactSchedulingState* state);
private:
BString fDataSourceName;
void* fEventData;
size_t fEventDataSize;
bigtime_t fBaseTime;
bigtime_t fLastEventTime;
nanotime_t fBaseTime;
nanotime_t fLastEventTime;
TeamList fTeams; // sorted by ID
ThreadList fThreads; // sorted by ID
WaitObjectGroupList fWaitObjectGroups;
@ -128,7 +128,7 @@ private:
struct Model::creation_time_id {
bigtime_t time;
nanotime_t time;
thread_id id;
};
@ -152,9 +152,9 @@ public:
inline addr_t ReferencedObject();
inline int64 Waits() const;
inline bigtime_t TotalWaitTime() const;
inline nanotime_t TotalWaitTime() const;
void AddWait(bigtime_t waitTime);
void AddWait(nanotime_t waitTime);
static inline int CompareByTypeObject(const WaitObject* a,
const WaitObject* b);
@ -167,7 +167,7 @@ private:
private:
int64 fWaits;
bigtime_t fTotalWaitTime;
nanotime_t fTotalWaitTime;
};
@ -181,7 +181,7 @@ public:
inline const char* Name() const;
int64 Waits();
bigtime_t TotalWaitTime();
nanotime_t TotalWaitTime();
inline WaitObject* MostRecentWaitObject() const;
@ -204,7 +204,7 @@ private:
private:
WaitObjectList fWaitObjects;
int64 fWaits;
bigtime_t fTotalWaitTime;
nanotime_t fTotalWaitTime;
};
@ -222,14 +222,14 @@ public:
inline addr_t ReferencedObject();
inline int64 Waits() const;
inline bigtime_t TotalWaitTime() const;
inline nanotime_t TotalWaitTime() const;
void AddWait(bigtime_t waitTime);
void AddWait(nanotime_t waitTime);
private:
WaitObject* fWaitObject;
int64 fWaits;
bigtime_t fTotalWaitTime;
nanotime_t fTotalWaitTime;
};
@ -266,18 +266,18 @@ private:
class Model::Team {
public:
Team(const system_profiler_team_added* event,
bigtime_t time);
nanotime_t time);
~Team();
inline team_id ID() const;
inline const char* Name() const;
inline bigtime_t CreationTime() const;
inline bigtime_t DeletionTime() const;
inline nanotime_t CreationTime() const;
inline nanotime_t DeletionTime() const;
bool AddThread(Thread* thread);
inline void SetDeletionTime(bigtime_t time);
inline void SetDeletionTime(nanotime_t time);
static inline int CompareByID(const Team* a, const Team* b);
static inline int CompareWithID(const team_id* id,
@ -288,8 +288,8 @@ private:
private:
const system_profiler_team_added* fCreationEvent;
bigtime_t fCreationTime;
bigtime_t fDeletionTime;
nanotime_t fCreationTime;
nanotime_t fDeletionTime;
ThreadList fThreads; // sorted by creation time, ID
};
@ -298,7 +298,7 @@ class Model::Thread {
public:
Thread(Team* team,
const system_profiler_thread_added* event,
bigtime_t time);
nanotime_t time);
~Thread();
inline thread_id ID() const;
@ -308,33 +308,33 @@ public:
inline int32 Index() const;
inline void SetIndex(int32 index);
inline bigtime_t CreationTime() const;
inline bigtime_t DeletionTime() const;
inline nanotime_t CreationTime() const;
inline nanotime_t DeletionTime() const;
inline int64 Runs() const;
inline bigtime_t TotalRunTime() const;
inline nanotime_t TotalRunTime() const;
inline int64 Reruns() const;
inline bigtime_t TotalRerunTime() const;
inline nanotime_t TotalRerunTime() const;
inline int64 Latencies() const;
inline bigtime_t TotalLatency() const;
inline nanotime_t TotalLatency() const;
inline int64 Preemptions() const;
inline int64 Waits() const;
inline bigtime_t TotalWaitTime() const;
inline bigtime_t UnspecifiedWaitTime() const;
inline nanotime_t TotalWaitTime() const;
inline nanotime_t UnspecifiedWaitTime() const;
ThreadWaitObjectGroup* ThreadWaitObjectGroupFor(uint32 type,
addr_t object) const;
inline int32 CountThreadWaitObjectGroups() const;
inline ThreadWaitObjectGroup* ThreadWaitObjectGroupAt(int32 index) const;
inline void SetDeletionTime(bigtime_t time);
inline void SetDeletionTime(nanotime_t time);
void AddRun(bigtime_t runTime);
void AddRerun(bigtime_t runTime);
void AddLatency(bigtime_t latency);
void AddPreemption(bigtime_t runTime);
void AddWait(bigtime_t waitTime);
void AddUnspecifiedWait(bigtime_t waitTime);
void AddRun(nanotime_t runTime);
void AddRerun(nanotime_t runTime);
void AddLatency(nanotime_t latency);
void AddPreemption(nanotime_t runTime);
void AddWait(nanotime_t waitTime);
void AddUnspecifiedWait(nanotime_t waitTime);
ThreadWaitObject* AddThreadWaitObject(WaitObject* waitObject,
ThreadWaitObjectGroup**
@ -357,27 +357,27 @@ private:
private:
Team* fTeam;
const system_profiler_thread_added* fCreationEvent;
bigtime_t fCreationTime;
bigtime_t fDeletionTime;
nanotime_t fCreationTime;
nanotime_t fDeletionTime;
int64 fRuns;
bigtime_t fTotalRunTime;
bigtime_t fMinRunTime;
bigtime_t fMaxRunTime;
nanotime_t fTotalRunTime;
nanotime_t fMinRunTime;
nanotime_t fMaxRunTime;
int64 fLatencies;
bigtime_t fTotalLatency;
bigtime_t fMinLatency;
bigtime_t fMaxLatency;
nanotime_t fTotalLatency;
nanotime_t fMinLatency;
nanotime_t fMaxLatency;
int64 fReruns;
bigtime_t fTotalRerunTime;
bigtime_t fMinRerunTime;
bigtime_t fMaxRerunTime;
nanotime_t fTotalRerunTime;
nanotime_t fMinRerunTime;
nanotime_t fMaxRerunTime;
int64 fWaits;
bigtime_t fTotalWaitTime;
bigtime_t fUnspecifiedWaitTime;
nanotime_t fTotalWaitTime;
nanotime_t fUnspecifiedWaitTime;
int64 fPreemptions;
@ -388,7 +388,7 @@ private:
struct Model::CompactThreadSchedulingState {
bigtime_t lastTime;
nanotime_t lastTime;
Model::Thread* thread;
ThreadWaitObject* waitObject;
ThreadState state;
@ -438,8 +438,8 @@ public:
status_t Init(const CompactSchedulingState* state);
void Clear();
inline bigtime_t LastEventTime() const { return fLastEventTime; }
inline void SetLastEventTime(bigtime_t time);
inline nanotime_t LastEventTime() const { return fLastEventTime; }
inline void SetLastEventTime(nanotime_t time);
inline ThreadSchedulingState* LookupThread(thread_id threadID) const;
inline void InsertThread(ThreadSchedulingState* thread);
@ -447,7 +447,7 @@ public:
inline const ThreadSchedulingStateTable& ThreadStates() const;
private:
bigtime_t fLastEventTime;
nanotime_t fLastEventTime;
ThreadSchedulingStateTable fThreadStates;
};
@ -459,7 +459,7 @@ public:
void Delete();
inline off_t EventOffset() const;
inline bigtime_t LastEventTime() const;
inline nanotime_t LastEventTime() const;
inline int32 CountThreadsStates() const;
inline const CompactThreadSchedulingState* ThreadStateAt(int32 index)
@ -474,7 +474,7 @@ private:
inline ~CompactSchedulingState() {}
private:
bigtime_t fLastEventTime;
nanotime_t fLastEventTime;
off_t fEventOffset;
int32 fThreadCount;
CompactThreadSchedulingState fThreadStates[0];
@ -505,14 +505,14 @@ Model::EventDataSize() const
}
bigtime_t
nanotime_t
Model::BaseTime() const
{
return fBaseTime;
}
bigtime_t
nanotime_t
Model::LastEventTime() const
{
return fLastEventTime;
@ -557,7 +557,7 @@ Model::WaitObject::Waits() const
}
bigtime_t
nanotime_t
Model::WaitObject::TotalWaitTime() const
{
return fTotalWaitTime;
@ -704,7 +704,7 @@ Model::ThreadWaitObject::Waits() const
}
bigtime_t
nanotime_t
Model::ThreadWaitObject::TotalWaitTime() const
{
return fTotalWaitTime;
@ -771,14 +771,14 @@ Model::Team::Name() const
}
bigtime_t
nanotime_t
Model::Team::CreationTime() const
{
return fCreationTime;
}
bigtime_t
nanotime_t
Model::Team::DeletionTime() const
{
return fDeletionTime;
@ -786,7 +786,7 @@ Model::Team::DeletionTime() const
void
Model::Team::SetDeletionTime(bigtime_t time)
Model::Team::SetDeletionTime(nanotime_t time)
{
fDeletionTime = time;
}
@ -830,14 +830,14 @@ Model::Thread::GetTeam() const
}
bigtime_t
nanotime_t
Model::Thread::CreationTime() const
{
return fCreationTime;
}
bigtime_t
nanotime_t
Model::Thread::DeletionTime() const
{
return fDeletionTime;
@ -865,7 +865,7 @@ Model::Thread::Runs() const
}
bigtime_t
nanotime_t
Model::Thread::TotalRunTime() const
{
return fTotalRunTime;
@ -879,7 +879,7 @@ Model::Thread::Reruns() const
}
bigtime_t
nanotime_t
Model::Thread::TotalRerunTime() const
{
return fTotalRerunTime;
@ -893,7 +893,7 @@ Model::Thread::Latencies() const
}
bigtime_t
nanotime_t
Model::Thread::TotalLatency() const
{
return fTotalLatency;
@ -914,14 +914,14 @@ Model::Thread::Waits() const
}
bigtime_t
nanotime_t
Model::Thread::TotalWaitTime() const
{
return fTotalWaitTime;
}
bigtime_t
nanotime_t
Model::Thread::UnspecifiedWaitTime() const
{
return fUnspecifiedWaitTime;
@ -943,7 +943,7 @@ Model::Thread::ThreadWaitObjectGroupAt(int32 index) const
void
Model::Thread::SetDeletionTime(bigtime_t time)
Model::Thread::SetDeletionTime(nanotime_t time)
{
fDeletionTime = time;
}
@ -977,7 +977,7 @@ Model::Thread::CompareByCreationTimeID(const Thread* a, const Thread* b)
Model::Thread::CompareWithCreationTimeID(const creation_time_id* key,
const Thread* thread)
{
bigtime_t cmp = key->time - thread->fCreationTime;
nanotime_t cmp = key->time - thread->fCreationTime;
if (cmp == 0)
return key->id - thread->ID();
return cmp < 0 ? -1 : 1;
@ -1029,7 +1029,7 @@ Model::SchedulingState::SchedulingState()
void
Model::SchedulingState::SetLastEventTime(bigtime_t time)
Model::SchedulingState::SetLastEventTime(nanotime_t time)
{
fLastEventTime = time;
}
@ -1073,7 +1073,7 @@ Model::CompactSchedulingState::EventOffset() const
}
bigtime_t
nanotime_t
Model::CompactSchedulingState::LastEventTime() const
{
return fLastEventTime;

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include "ThreadModel.h"
#include <new>
@ -93,7 +94,7 @@ ThreadModel::AddSchedulingEvent(const system_profiler_event_header* eventHeader)
int32
ThreadModel::FindSchedulingEvent(bigtime_t time)
ThreadModel::FindSchedulingEvent(nanotime_t time)
{
if (time < 0)
return 0;

View File

@ -5,6 +5,7 @@
#ifndef THREAD_MODEL_H
#define THREAD_MODEL_H
#include <string.h>
#include "Model.h"
@ -36,7 +37,7 @@ public:
inline int32 CountSchedulingEvents() const;
inline const system_profiler_event_header* SchedulingEventAt(
int32 index) const;
int32 FindSchedulingEvent(bigtime_t time);
int32 FindSchedulingEvent(nanotime_t time);
private:
typedef BObjectList<WaitObjectGroup> WaitObjectGroupList;
@ -67,7 +68,7 @@ public:
inline const char* Name() const;
inline int64 Waits() const;
inline bigtime_t TotalWaitTime() const;
inline nanotime_t TotalWaitTime() const;
inline int32 CountWaitObjects() const;
inline Model::ThreadWaitObject* WaitObjectAt(int32 index) const;
@ -82,7 +83,7 @@ private:
Model::ThreadWaitObject** fWaitObjects;
int32 fCount;
int64 fWaits;
bigtime_t fTotalWaitTime;
nanotime_t fTotalWaitTime;
};
@ -141,7 +142,7 @@ ThreadModel::WaitObjectGroup::Waits() const
}
bigtime_t
nanotime_t
ThreadModel::WaitObjectGroup::TotalWaitTime() const
{
return fTotalWaitTime;

View File

@ -48,7 +48,7 @@ static const SimpleWaitObjectInfo kSignalWaitObjectInfo(
inline void
ModelLoader::_UpdateLastEventTime(bigtime_t time)
ModelLoader::_UpdateLastEventTime(nanotime_t time)
{
if (fBaseTime < 0) {
fBaseTime = time;
@ -392,7 +392,7 @@ ModelLoader::_HandleThreadScheduled(system_profiler_thread_scheduled* event)
return;
}
bigtime_t diffTime = fState.LastEventTime() - thread->lastTime;
nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
if (thread->state == READY) {
// thread scheduled after having been woken up
@ -493,7 +493,7 @@ ModelLoader::_HandleThreadEnqueuedInRunQueue(
thread->state = STILL_RUNNING;
} else {
// Thread was waiting and is ready now.
bigtime_t diffTime = fState.LastEventTime() - thread->lastTime;
nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
if (thread->waitObject != NULL) {
thread->waitObject->AddWait(diffTime);
thread->waitObject = NULL;
@ -523,7 +523,7 @@ ModelLoader::_HandleThreadRemovedFromRunQueue(
// This really only happens when the thread priority is changed
// while the thread is ready.
bigtime_t diffTime = fState.LastEventTime() - thread->lastTime;
nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
if (thread->state == RUNNING) {
// This should never happen.
thread->thread->AddRun(diffTime);

View File

@ -47,7 +47,7 @@ private:
status_t _ProcessEvent(uint32 event, uint32 cpu,
const void* buffer, size_t size);
inline void _UpdateLastEventTime(bigtime_t time);
inline void _UpdateLastEventTime(nanotime_t time);
void _HandleTeamAdded(
system_profiler_team_added* event);
@ -76,7 +76,7 @@ private:
private:
Model* fModel;
DataSource* fDataSource;
bigtime_t fBaseTime;
nanotime_t fBaseTime;
Model::SchedulingState fState;
};

View File

@ -0,0 +1,87 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef TIME_UTILS_H
#define TIME_UTILS_H
#include <stdio.h>
struct decomposed_bigtime {
nanotime_t hours;
int minutes;
int seconds;
int micros;
};
struct decomposed_nanotime {
nanotime_t hours;
int minutes;
int seconds;
int nanos;
};
static void
decompose_time(bigtime_t time, decomposed_bigtime& decomposed)
{
// nanosecs
decomposed.micros = time % 1000000;
time /= 1000000;
// secs
decomposed.seconds = time % 60;
time /= 60;
// mins
decomposed.minutes = time % 60;
time /= 60;
// hours
decomposed.hours = time;
}
static void
decompose_time(nanotime_t time, decomposed_nanotime& decomposed)
{
// nanosecs
decomposed.nanos = time % 1000000000;
time /= 1000000000;
// secs
decomposed.seconds = time % 60;
time /= 60;
// mins
decomposed.minutes = time % 60;
time /= 60;
// hours
decomposed.hours = time;
}
static inline const char*
format_bigtime(bigtime_t time, char* buffer, size_t bufferSize)
{
decomposed_bigtime decomposed;
decompose_time(time, decomposed);
snprintf(buffer, bufferSize, "%02lld:%02d:%02d:%06d", decomposed.hours,
decomposed.minutes, decomposed.seconds, decomposed.micros);
return buffer;
}
static inline const char*
format_nanotime(nanotime_t time, char* buffer, size_t bufferSize)
{
decomposed_nanotime decomposed;
decompose_time(time, decomposed);
snprintf(buffer, bufferSize, "%02lld:%02d:%02d:%09d", decomposed.hours,
decomposed.minutes, decomposed.seconds, decomposed.nanos);
return buffer;
}
#endif // TIME_UTILS_H

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include <system_profiler.h>
#include <AutoDeleter.h>
@ -627,7 +628,7 @@ SystemProfiler::ThreadEnqueuedInRunQueue(struct thread* thread)
if (event == NULL)
return;
event->time = system_time();
event->time = system_time_nsecs();
event->thread = thread->id;
event->priority = thread->priority;
@ -658,7 +659,7 @@ SystemProfiler::ThreadRemovedFromRunQueue(struct thread* thread)
if (event == NULL)
return;
event->time = system_time();
event->time = system_time_nsecs();
event->thread = thread->id;
fHeader->size = fBufferSize;
@ -688,7 +689,7 @@ SystemProfiler::ThreadScheduled(struct thread* oldThread,
if (event == NULL)
return;
event->time = system_time();
event->time = system_time_nsecs();
event->thread = newThread->id;
event->previous_thread = oldThread->id;
event->previous_thread_state = oldThread->state;