* 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:
@@ -5,6 +5,7 @@
|
|||||||
#ifndef _SYSTEM_SYSTEM_PROFILER_DEFS_H
|
#ifndef _SYSTEM_SYSTEM_PROFILER_DEFS_H
|
||||||
#define _SYSTEM_SYSTEM_PROFILER_DEFS_H
|
#define _SYSTEM_SYSTEM_PROFILER_DEFS_H
|
||||||
|
|
||||||
|
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -130,13 +131,13 @@ struct system_profiler_samples {
|
|||||||
|
|
||||||
// base structure for the following three
|
// base structure for the following three
|
||||||
struct system_profiler_thread_scheduling_event {
|
struct system_profiler_thread_scheduling_event {
|
||||||
bigtime_t time;
|
nanotime_t time;
|
||||||
thread_id thread;
|
thread_id thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
// B_SYSTEM_PROFILER_THREAD_SCHEDULED
|
// B_SYSTEM_PROFILER_THREAD_SCHEDULED
|
||||||
struct system_profiler_thread_scheduled {
|
struct system_profiler_thread_scheduled {
|
||||||
bigtime_t time;
|
nanotime_t time;
|
||||||
thread_id thread;
|
thread_id thread;
|
||||||
thread_id previous_thread;
|
thread_id previous_thread;
|
||||||
uint16 previous_thread_state;
|
uint16 previous_thread_state;
|
||||||
@@ -146,14 +147,14 @@ struct system_profiler_thread_scheduled {
|
|||||||
|
|
||||||
// B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE
|
// B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE
|
||||||
struct system_profiler_thread_enqueued_in_run_queue {
|
struct system_profiler_thread_enqueued_in_run_queue {
|
||||||
bigtime_t time;
|
nanotime_t time;
|
||||||
thread_id thread;
|
thread_id thread;
|
||||||
uint8 priority;
|
uint8 priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
// B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE
|
// B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE
|
||||||
struct system_profiler_thread_removed_from_run_queue {
|
struct system_profiler_thread_removed_from_run_queue {
|
||||||
bigtime_t time;
|
nanotime_t time;
|
||||||
thread_id thread;
|
thread_id thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,31 +9,7 @@
|
|||||||
|
|
||||||
#include "chart/ChartDataRange.h"
|
#include "chart/ChartDataRange.h"
|
||||||
#include "chart/StringChartLegend.h"
|
#include "chart/StringChartLegend.h"
|
||||||
|
#include "util/TimeUtils.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
@@ -80,7 +56,7 @@ BigtimeChartAxisLegendSource::GetAxisLegends(const ChartDataRange& range,
|
|||||||
bigtime_t interval = baseInterval * relativeFactor;
|
bigtime_t interval = baseInterval * relativeFactor;
|
||||||
bigtime_t time = (startTime + interval - 1) / interval * interval;
|
bigtime_t time = (startTime + interval - 1) / interval * interval;
|
||||||
for (; time <= endTime; time += interval) {
|
for (; time <= endTime; time += interval) {
|
||||||
decomposed_time decomposed;
|
decomposed_bigtime decomposed;
|
||||||
decompose_time(time, decomposed);
|
decompose_time(time, decomposed);
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
snprintf(buffer, sizeof(buffer), "%02lld:%02d:%02d.%06d",
|
snprintf(buffer, sizeof(buffer), "%02lld:%02d:%02d.%06d",
|
||||||
|
|||||||
@@ -19,5 +19,6 @@ MergeObject DebugAnalyzer_gui_chart.o
|
|||||||
DefaultChartAxisLegendSource.cpp
|
DefaultChartAxisLegendSource.cpp
|
||||||
LegendChartAxis.cpp
|
LegendChartAxis.cpp
|
||||||
LineChartRenderer.cpp
|
LineChartRenderer.cpp
|
||||||
|
NanotimeChartAxisLegendSource.cpp
|
||||||
StringChartLegend.cpp
|
StringChartLegend.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
|
* 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
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "util/TimeUtils.h"
|
||||||
|
|
||||||
|
|
||||||
MainWindow::GeneralPage::GeneralPage()
|
MainWindow::GeneralPage::GeneralPage()
|
||||||
:
|
:
|
||||||
@@ -43,8 +45,8 @@ MainWindow::GeneralPage::SetModel(Model* model)
|
|||||||
|
|
||||||
// run time
|
// run time
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs", fModel->LastEventTime());
|
fRunTimeView->SetText(format_nanotime(fModel->LastEventTime(), buffer,
|
||||||
fRunTimeView->SetText(buffer);
|
sizeof(buffer)));
|
||||||
|
|
||||||
// team count
|
// team count
|
||||||
snprintf(buffer, sizeof(buffer), "%ld", fModel->CountTeams());
|
snprintf(buffer, sizeof(buffer), "%ld", fModel->CountTeams());
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "Array.h"
|
#include "Array.h"
|
||||||
|
|
||||||
#include "chart/BigtimeChartAxisLegendSource.h"
|
#include "chart/NanotimeChartAxisLegendSource.h"
|
||||||
#include "chart/LegendChartAxis.h"
|
#include "chart/LegendChartAxis.h"
|
||||||
#include "chart/StringChartLegend.h"
|
#include "chart/StringChartLegend.h"
|
||||||
#include "HeaderView.h"
|
#include "HeaderView.h"
|
||||||
@@ -34,11 +34,11 @@ static const float kViewSeparationMargin = 5.0f;
|
|||||||
|
|
||||||
|
|
||||||
struct MainWindow::SchedulingPage::SchedulingEvent {
|
struct MainWindow::SchedulingPage::SchedulingEvent {
|
||||||
bigtime_t time;
|
nanotime_t time;
|
||||||
Model::ThreadWaitObjectGroup* waitObject;
|
Model::ThreadWaitObjectGroup* waitObject;
|
||||||
ThreadState state;
|
ThreadState state;
|
||||||
|
|
||||||
SchedulingEvent(bigtime_t time, ThreadState state,
|
SchedulingEvent(nanotime_t time, ThreadState state,
|
||||||
Model::ThreadWaitObjectGroup* waitObject)
|
Model::ThreadWaitObjectGroup* waitObject)
|
||||||
:
|
:
|
||||||
time(time),
|
time(time),
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
return fDataArrays[index];
|
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)
|
Model::ThreadWaitObjectGroup* waitObject)
|
||||||
{
|
{
|
||||||
DataArray& array = fDataArrays[thread->Index()];
|
DataArray& array = fDataArrays[thread->Index()];
|
||||||
@@ -117,28 +117,28 @@ public:
|
|||||||
array.Add(event);
|
array.Add(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRun(Model::Thread* thread, bigtime_t time)
|
void AddRun(Model::Thread* thread, nanotime_t time)
|
||||||
{
|
{
|
||||||
AddState(thread, time, RUNNING, NULL);
|
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);
|
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);
|
AddState(thread, time, PREEMPTED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddWait(Model::Thread* thread, bigtime_t time,
|
void AddWait(Model::Thread* thread, nanotime_t time,
|
||||||
Model::ThreadWaitObjectGroup* waitObject)
|
Model::ThreadWaitObjectGroup* waitObject)
|
||||||
{
|
{
|
||||||
AddState(thread, time, WAITING, 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);
|
AddState(thread, time, WAITING, NULL);
|
||||||
}
|
}
|
||||||
@@ -154,10 +154,10 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
struct MainWindow::SchedulingPage::TimeRange : BReferenceable {
|
struct MainWindow::SchedulingPage::TimeRange : BReferenceable {
|
||||||
bigtime_t startTime;
|
nanotime_t startTime;
|
||||||
bigtime_t endTime;
|
nanotime_t endTime;
|
||||||
|
|
||||||
TimeRange(bigtime_t startTime, bigtime_t endTime)
|
TimeRange(nanotime_t startTime, nanotime_t endTime)
|
||||||
:
|
:
|
||||||
startTime(startTime),
|
startTime(startTime),
|
||||||
endTime(endTime)
|
endTime(endTime)
|
||||||
@@ -171,7 +171,7 @@ class MainWindow::SchedulingPage::TimelineHeaderRenderer
|
|||||||
public:
|
public:
|
||||||
TimelineHeaderRenderer()
|
TimelineHeaderRenderer()
|
||||||
:
|
:
|
||||||
fAxis(new BigtimeChartAxisLegendSource, new StringChartLegendRenderer)
|
fAxis(new NanotimeChartAxisLegendSource, new StringChartLegendRenderer)
|
||||||
{
|
{
|
||||||
fAxis.SetLocation(CHART_AXIS_TOP);
|
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);
|
_GetEventTimeRange(_startTime, _endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual BSize MinSize()
|
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);
|
float width = std::max(float(timeSpan / fUSecsPerPixel), 100.0f);
|
||||||
return BSize(width, TotalHeight());
|
return BSize(width, TotalHeight());
|
||||||
}
|
}
|
||||||
@@ -446,8 +446,8 @@ public:
|
|||||||
//printf("drawing events for thread %ld: %ld events\n", thread->Index(), eventCount);
|
//printf("drawing events for thread %ld: %ld events\n", thread->Index(), eventCount);
|
||||||
for (int32 k = 0; k < eventCount; k++) {
|
for (int32 k = 0; k < eventCount; k++) {
|
||||||
const SchedulingEvent& event = events[k];
|
const SchedulingEvent& event = events[k];
|
||||||
bigtime_t startTime = std::max(event.time, fStartTime);
|
nanotime_t startTime = std::max(event.time, fStartTime);
|
||||||
bigtime_t endTime = k + 1 < eventCount
|
nanotime_t endTime = k + 1 < eventCount
|
||||||
? std::min(events[k + 1].time, fEndTime) : fEndTime;
|
? std::min(events[k + 1].time, fEndTime) : fEndTime;
|
||||||
|
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
@@ -488,8 +488,8 @@ private:
|
|||||||
void _UpdateData()
|
void _UpdateData()
|
||||||
{
|
{
|
||||||
// get the interesting event time range
|
// get the interesting event time range
|
||||||
bigtime_t startTime;
|
nanotime_t startTime;
|
||||||
bigtime_t endTime;
|
nanotime_t endTime;
|
||||||
_GetEventTimeRange(startTime, endTime);
|
_GetEventTimeRange(startTime, endTime);
|
||||||
|
|
||||||
if (startTime == fStartTime && endTime == fEndTime)
|
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) {
|
if (fModel != NULL) {
|
||||||
float scrollOffset = _ScrollOffset();
|
float scrollOffset = _ScrollOffset();
|
||||||
_startTime = (bigtime_t)scrollOffset * fUSecsPerPixel;
|
_startTime = (nanotime_t)scrollOffset * fUSecsPerPixel;
|
||||||
_endTime = (bigtime_t)(scrollOffset + Bounds().Width() + 1)
|
_endTime = (nanotime_t)(scrollOffset + Bounds().Width() + 1)
|
||||||
* fUSecsPerPixel;
|
* fUSecsPerPixel;
|
||||||
} else {
|
} else {
|
||||||
_startTime = 0;
|
_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());
|
fState.SetLastEventTime(time - fModel->BaseTime());
|
||||||
}
|
}
|
||||||
@@ -834,7 +834,7 @@ return B_BAD_DATA;
|
|||||||
thread->state = STILL_RUNNING;
|
thread->state = STILL_RUNNING;
|
||||||
} else {
|
} else {
|
||||||
// Thread was waiting and is ready now.
|
// 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) {
|
if (thread->waitObject != NULL) {
|
||||||
thread->waitObject->AddWait(diffTime);
|
thread->waitObject->AddWait(diffTime);
|
||||||
thread->waitObject = NULL;
|
thread->waitObject = NULL;
|
||||||
@@ -870,8 +870,8 @@ return B_BAD_DATA;
|
|||||||
private:
|
private:
|
||||||
Model::SchedulingState fState;
|
Model::SchedulingState fState;
|
||||||
SchedulingData fSchedulingData;
|
SchedulingData fSchedulingData;
|
||||||
bigtime_t fStartTime;
|
nanotime_t fStartTime;
|
||||||
bigtime_t fEndTime;
|
nanotime_t fEndTime;
|
||||||
uint32 fUSecsPerPixel;
|
uint32 fUSecsPerPixel;
|
||||||
BPoint fLastMousePos;
|
BPoint fLastMousePos;
|
||||||
Listener* fListener;
|
Listener* fListener;
|
||||||
@@ -996,8 +996,8 @@ private:
|
|||||||
if (header == NULL)
|
if (header == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bigtime_t startTime;
|
nanotime_t startTime;
|
||||||
bigtime_t endTime;
|
nanotime_t endTime;
|
||||||
fSchedulingView->GetDataRange(startTime, endTime);
|
fSchedulingView->GetDataRange(startTime, endTime);
|
||||||
TimeRange* range = new(std::nothrow) TimeRange(startTime, endTime);
|
TimeRange* range = new(std::nothrow) TimeRange(startTime, endTime);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "main_window/TeamsPage.h"
|
#include "main_window/TeamsPage.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -82,9 +83,9 @@ MainWindow::TeamsPage::TeamsPage(MainWindow* parent)
|
|||||||
B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
||||||
fTeamsTable->AddColumn(new StringTableColumn(1, "Name", 80, 40, 1000,
|
fTeamsTable->AddColumn(new StringTableColumn(1, "Name", 80, 40, 1000,
|
||||||
B_TRUNCATE_END, B_ALIGN_LEFT));
|
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));
|
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));
|
false, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
||||||
|
|
||||||
fTeamsTable->AddTableListener(this);
|
fTeamsTable->AddTableListener(this);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "main_window/ThreadsPage.h"
|
#include "main_window/ThreadsPage.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -120,27 +121,27 @@ MainWindow::ThreadsPage::ThreadsPage(MainWindow* parent)
|
|||||||
B_TRUNCATE_END, B_ALIGN_LEFT));
|
B_TRUNCATE_END, B_ALIGN_LEFT));
|
||||||
fThreadsTable->AddColumn(new StringTableColumn(2, "Team", 80, 40, 1000,
|
fThreadsTable->AddColumn(new StringTableColumn(2, "Team", 80, 40, 1000,
|
||||||
B_TRUNCATE_END, B_ALIGN_LEFT));
|
B_TRUNCATE_END, B_ALIGN_LEFT));
|
||||||
fThreadsTable->AddColumn(new BigtimeTableColumn(3, "Creation", 80, 40, 1000,
|
fThreadsTable->AddColumn(new NanotimeTableColumn(3, "Creation", 80, 40,
|
||||||
true, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
1000, true, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new BigtimeTableColumn(4, "Deletion", 80, 40, 1000,
|
fThreadsTable->AddColumn(new NanotimeTableColumn(4, "Deletion", 80, 40,
|
||||||
false, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
1000, false, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new Int64TableColumn(5, "Runs", 80, 20, 1000,
|
fThreadsTable->AddColumn(new Int64TableColumn(5, "Runs", 80, 20, 1000,
|
||||||
B_TRUNCATE_END, B_ALIGN_RIGHT));
|
B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new BigtimeTableColumn(6, "Run Time", 80, 20, 1000,
|
fThreadsTable->AddColumn(new NanotimeTableColumn(6, "Run Time", 80, 20,
|
||||||
false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new Int64TableColumn(7, "Latencies", 80, 20, 1000,
|
fThreadsTable->AddColumn(new Int64TableColumn(7, "Latencies", 80, 20, 1000,
|
||||||
B_TRUNCATE_END, B_ALIGN_RIGHT));
|
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));
|
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new Int64TableColumn(9, "Preemptions", 80, 20,
|
fThreadsTable->AddColumn(new Int64TableColumn(9, "Preemptions", 80, 20,
|
||||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
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));
|
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
fThreadsTable->AddColumn(new Int64TableColumn(11, "Waits", 80, 20,
|
fThreadsTable->AddColumn(new Int64TableColumn(11, "Waits", 80, 20,
|
||||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
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));
|
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));
|
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
|
|
||||||
fThreadsTable->AddTableListener(this);
|
fThreadsTable->AddTableListener(this);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ MainWindow::WaitObjectsPage::WaitObjectsPage(MainWindow* parent)
|
|||||||
// 1000, B_TRUNCATE_END, B_ALIGN_LEFT));
|
// 1000, B_TRUNCATE_END, B_ALIGN_LEFT));
|
||||||
fWaitObjectsTable->AddColumn(new Int64TableColumn(4, "Waits", 80, 40,
|
fWaitObjectsTable->AddColumn(new Int64TableColumn(4, "Waits", 80, 40,
|
||||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
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));
|
40, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "util/TimeUtils.h"
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - DelegateBasedTableColumn
|
// #pragma mark - DelegateBasedTableColumn
|
||||||
|
|
||||||
@@ -211,16 +213,8 @@ BigtimeTableColumn::PrepareField(const BVariant& value) const
|
|||||||
BVariant("-", B_VARIANT_DONT_COPY_DATA));
|
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];
|
char buffer[64];
|
||||||
snprintf(buffer, sizeof(buffer), "%02lld:%02d:%02d:%06d", time, minutes,
|
format_bigtime(time, buffer, sizeof(buffer));
|
||||||
seconds, micros);
|
|
||||||
return StringTableColumn::PrepareField(
|
return StringTableColumn::PrepareField(
|
||||||
BVariant(buffer, B_VARIANT_DONT_COPY_DATA));
|
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;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
#endif // TABLE_COLUMNS_H
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "thread_window/ActivityPage.h"
|
#include "thread_window/ActivityPage.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
#include "MessageCodes.h"
|
#include "MessageCodes.h"
|
||||||
#include "ThreadModel.h"
|
#include "ThreadModel.h"
|
||||||
|
|
||||||
#include "chart/BigtimeChartAxisLegendSource.h"
|
#include "chart/NanotimeChartAxisLegendSource.h"
|
||||||
#include "chart/Chart.h"
|
#include "chart/Chart.h"
|
||||||
#include "chart/ChartDataSource.h"
|
#include "chart/ChartDataSource.h"
|
||||||
#include "chart/DefaultChartAxisLegendSource.h"
|
#include "chart/DefaultChartAxisLegendSource.h"
|
||||||
@@ -69,8 +70,8 @@ public:
|
|||||||
|
|
||||||
double sampleLength = (end - start) / (double)sampleCount;
|
double sampleLength = (end - start) / (double)sampleCount;
|
||||||
|
|
||||||
int32 startIndex = fModel->FindSchedulingEvent((bigtime_t)start);
|
int32 startIndex = fModel->FindSchedulingEvent((nanotime_t)start);
|
||||||
bigtime_t baseTime = fModel->GetModel()->BaseTime();
|
nanotime_t baseTime = fModel->GetModel()->BaseTime();
|
||||||
|
|
||||||
enum ScheduleState {
|
enum ScheduleState {
|
||||||
RUNNING,
|
RUNNING,
|
||||||
@@ -375,11 +376,11 @@ ThreadWindow::ActivityPage::ActivityPage()
|
|||||||
|
|
||||||
// TODO: Allocation management...
|
// TODO: Allocation management...
|
||||||
LegendChartAxis* axis = new LegendChartAxis(
|
LegendChartAxis* axis = new LegendChartAxis(
|
||||||
new BigtimeChartAxisLegendSource, new StringChartLegendRenderer);
|
new NanotimeChartAxisLegendSource, new StringChartLegendRenderer);
|
||||||
fActivityChart->SetAxis(CHART_AXIS_BOTTOM, axis);
|
fActivityChart->SetAxis(CHART_AXIS_BOTTOM, axis);
|
||||||
|
|
||||||
axis = new LegendChartAxis(
|
axis = new LegendChartAxis(
|
||||||
new BigtimeChartAxisLegendSource, new StringChartLegendRenderer);
|
new NanotimeChartAxisLegendSource, new StringChartLegendRenderer);
|
||||||
fActivityChart->SetAxis(CHART_AXIS_TOP, axis);
|
fActivityChart->SetAxis(CHART_AXIS_TOP, axis);
|
||||||
|
|
||||||
axis = new LegendChartAxis(
|
axis = new LegendChartAxis(
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "util/TimeUtils.h"
|
||||||
|
|
||||||
|
|
||||||
ThreadWindow::GeneralPage::GeneralPage()
|
ThreadWindow::GeneralPage::GeneralPage()
|
||||||
:
|
:
|
||||||
@@ -60,29 +62,38 @@ ThreadWindow::GeneralPage::SetModel(Model* model, Model::Thread* thread)
|
|||||||
fTeamView->SetText(thread->GetTeam()->Name());
|
fTeamView->SetText(thread->GetTeam()->Name());
|
||||||
|
|
||||||
// run time
|
// run time
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
char timeBuffer[64];
|
||||||
fThread->TotalRunTime(), fThread->Runs());
|
format_nanotime(fThread->TotalRunTime(), timeBuffer,
|
||||||
|
sizeof(timeBuffer));
|
||||||
|
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
|
||||||
|
fThread->Runs());
|
||||||
fRunTimeView->SetText(buffer);
|
fRunTimeView->SetText(buffer);
|
||||||
|
|
||||||
// wait time
|
// wait time
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
format_nanotime(fThread->TotalWaitTime(), timeBuffer,
|
||||||
fThread->TotalWaitTime(), fThread->Waits());
|
sizeof(timeBuffer));
|
||||||
|
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
|
||||||
|
fThread->Waits());
|
||||||
fWaitTimeView->SetText(buffer);
|
fWaitTimeView->SetText(buffer);
|
||||||
|
|
||||||
// latencies
|
// latencies
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
format_nanotime(fThread->TotalLatency(), timeBuffer,
|
||||||
fThread->TotalLatency(), fThread->Latencies());
|
sizeof(timeBuffer));
|
||||||
|
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
|
||||||
|
fThread->Latencies());
|
||||||
fLatencyView->SetText(buffer);
|
fLatencyView->SetText(buffer);
|
||||||
|
|
||||||
// preemptions
|
// preemptions
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs (%lld)",
|
format_nanotime(fThread->TotalRerunTime(), timeBuffer,
|
||||||
fThread->TotalRerunTime(), fThread->Preemptions());
|
sizeof(timeBuffer));
|
||||||
|
snprintf(buffer, sizeof(buffer), "%s (%lld)", timeBuffer,
|
||||||
|
fThread->Preemptions());
|
||||||
fPreemptionView->SetText(buffer);
|
fPreemptionView->SetText(buffer);
|
||||||
|
|
||||||
// unspecified time
|
// unspecified time
|
||||||
snprintf(buffer, sizeof(buffer), "%lld μs",
|
format_nanotime(fThread->UnspecifiedWaitTime(), timeBuffer,
|
||||||
fThread->UnspecifiedWaitTime());
|
sizeof(timeBuffer));
|
||||||
fUnspecifiedTimeView->SetText(buffer);
|
fUnspecifiedTimeView->SetText(timeBuffer);
|
||||||
} else {
|
} else {
|
||||||
fThreadNameView->SetText("");
|
fThreadNameView->SetText("");
|
||||||
fThreadIDView->SetText("");
|
fThreadIDView->SetText("");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "thread_window/WaitObjectsPage.h"
|
#include "thread_window/WaitObjectsPage.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -290,7 +291,7 @@ ThreadWindow::WaitObjectsPage::WaitObjectsPage()
|
|||||||
1000, B_TRUNCATE_END, B_ALIGN_LEFT));
|
1000, B_TRUNCATE_END, B_ALIGN_LEFT));
|
||||||
fWaitObjectsTree->AddColumn(new Int64TableColumn(4, "Waits", 80, 20,
|
fWaitObjectsTree->AddColumn(new Int64TableColumn(4, "Waits", 80, 20,
|
||||||
1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
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));
|
20, 1000, false, B_TRUNCATE_END, B_ALIGN_RIGHT));
|
||||||
|
|
||||||
fWaitObjectsTree->AddTreeTableListener(this);
|
fWaitObjectsTree->AddTreeTableListener(this);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ Model::WaitObject::~WaitObject()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::WaitObject::AddWait(bigtime_t waitTime)
|
Model::WaitObject::AddWait(nanotime_t waitTime)
|
||||||
{
|
{
|
||||||
fWaits++;
|
fWaits++;
|
||||||
fTotalWaitTime += waitTime;
|
fTotalWaitTime += waitTime;
|
||||||
@@ -66,7 +66,7 @@ Model::WaitObjectGroup::Waits()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::WaitObjectGroup::TotalWaitTime()
|
Model::WaitObjectGroup::TotalWaitTime()
|
||||||
{
|
{
|
||||||
if (fTotalWaitTime < 0)
|
if (fTotalWaitTime < 0)
|
||||||
@@ -109,7 +109,7 @@ Model::ThreadWaitObject::~ThreadWaitObject()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::ThreadWaitObject::AddWait(bigtime_t waitTime)
|
Model::ThreadWaitObject::AddWait(nanotime_t waitTime)
|
||||||
{
|
{
|
||||||
fWaits++;
|
fWaits++;
|
||||||
fTotalWaitTime += waitTime;
|
fTotalWaitTime += waitTime;
|
||||||
@@ -150,7 +150,7 @@ Model::ThreadWaitObjectGroup::GetThreadWaitObjects(
|
|||||||
// #pragma mark - Team
|
// #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),
|
fCreationEvent(event),
|
||||||
fCreationTime(time),
|
fCreationTime(time),
|
||||||
@@ -176,7 +176,7 @@ Model::Team::AddThread(Thread* thread)
|
|||||||
|
|
||||||
|
|
||||||
Model::Thread::Thread(Team* team, const system_profiler_thread_added* event,
|
Model::Thread::Thread(Team* team, const system_profiler_thread_added* event,
|
||||||
bigtime_t time)
|
nanotime_t time)
|
||||||
:
|
:
|
||||||
fTeam(team),
|
fTeam(team),
|
||||||
fCreationEvent(event),
|
fCreationEvent(event),
|
||||||
@@ -222,7 +222,7 @@ Model::Thread::ThreadWaitObjectGroupFor(uint32 type, addr_t object) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddRun(bigtime_t runTime)
|
Model::Thread::AddRun(nanotime_t runTime)
|
||||||
{
|
{
|
||||||
fRuns++;
|
fRuns++;
|
||||||
fTotalRunTime += runTime;
|
fTotalRunTime += runTime;
|
||||||
@@ -235,7 +235,7 @@ Model::Thread::AddRun(bigtime_t runTime)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddRerun(bigtime_t runTime)
|
Model::Thread::AddRerun(nanotime_t runTime)
|
||||||
{
|
{
|
||||||
fReruns++;
|
fReruns++;
|
||||||
fTotalRerunTime += runTime;
|
fTotalRerunTime += runTime;
|
||||||
@@ -248,7 +248,7 @@ Model::Thread::AddRerun(bigtime_t runTime)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddLatency(bigtime_t latency)
|
Model::Thread::AddLatency(nanotime_t latency)
|
||||||
{
|
{
|
||||||
fLatencies++;
|
fLatencies++;
|
||||||
fTotalLatency += latency;
|
fTotalLatency += latency;
|
||||||
@@ -261,14 +261,14 @@ Model::Thread::AddLatency(bigtime_t latency)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddPreemption(bigtime_t runTime)
|
Model::Thread::AddPreemption(nanotime_t runTime)
|
||||||
{
|
{
|
||||||
fPreemptions++;
|
fPreemptions++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddWait(bigtime_t waitTime)
|
Model::Thread::AddWait(nanotime_t waitTime)
|
||||||
{
|
{
|
||||||
fWaits++;
|
fWaits++;
|
||||||
fTotalWaitTime += waitTime;
|
fTotalWaitTime += waitTime;
|
||||||
@@ -276,7 +276,7 @@ Model::Thread::AddWait(bigtime_t waitTime)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::AddUnspecifiedWait(bigtime_t waitTime)
|
Model::Thread::AddUnspecifiedWait(nanotime_t waitTime)
|
||||||
{
|
{
|
||||||
fUnspecifiedWaitTime += waitTime;
|
fUnspecifiedWaitTime += waitTime;
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ Model::SchedulingState::Clear()
|
|||||||
Model::CompactSchedulingState::Create(const SchedulingState& state,
|
Model::CompactSchedulingState::Create(const SchedulingState& state,
|
||||||
off_t eventOffset)
|
off_t eventOffset)
|
||||||
{
|
{
|
||||||
bigtime_t lastEventTime = state.LastEventTime();
|
nanotime_t lastEventTime = state.LastEventTime();
|
||||||
|
|
||||||
// count the active threads
|
// count the active threads
|
||||||
int32 threadCount = 0;
|
int32 threadCount = 0;
|
||||||
@@ -475,14 +475,14 @@ Model::LoadingFinished()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SetBaseTime(bigtime_t time)
|
Model::SetBaseTime(nanotime_t time)
|
||||||
{
|
{
|
||||||
fBaseTime = time;
|
fBaseTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SetLastEventTime(bigtime_t time)
|
Model::SetLastEventTime(nanotime_t time)
|
||||||
{
|
{
|
||||||
fLastEventTime = time;
|
fLastEventTime = time;
|
||||||
}
|
}
|
||||||
@@ -510,7 +510,7 @@ Model::TeamByID(team_id id) const
|
|||||||
|
|
||||||
|
|
||||||
Model::Team*
|
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);
|
Team* team = TeamByID(event->team);
|
||||||
if (team != NULL) {
|
if (team != NULL) {
|
||||||
@@ -554,7 +554,7 @@ Model::ThreadByID(thread_id id) const
|
|||||||
|
|
||||||
|
|
||||||
Model::Thread*
|
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
|
// check whether we do already know the thread
|
||||||
Thread* thread = ThreadByID(event->thread);
|
Thread* thread = ThreadByID(event->thread);
|
||||||
@@ -696,7 +696,7 @@ Model::AddSchedulingStateSnapshot(const SchedulingState& state,
|
|||||||
|
|
||||||
|
|
||||||
const Model::CompactSchedulingState*
|
const Model::CompactSchedulingState*
|
||||||
Model::ClosestSchedulingState(bigtime_t eventTime) const
|
Model::ClosestSchedulingState(nanotime_t eventTime) const
|
||||||
{
|
{
|
||||||
int32 index = fSchedulingStates.BinarySearchIndexByKey(eventTime,
|
int32 index = fSchedulingStates.BinarySearchIndexByKey(eventTime,
|
||||||
&_CompareEventTimeSchedulingState);
|
&_CompareEventTimeSchedulingState);
|
||||||
@@ -710,7 +710,7 @@ Model::ClosestSchedulingState(bigtime_t eventTime) const
|
|||||||
|
|
||||||
|
|
||||||
/*static*/ int
|
/*static*/ int
|
||||||
Model::_CompareEventTimeSchedulingState(const bigtime_t* time,
|
Model::_CompareEventTimeSchedulingState(const nanotime_t* time,
|
||||||
const CompactSchedulingState* state)
|
const CompactSchedulingState* state)
|
||||||
{
|
{
|
||||||
if (*time < state->LastEventTime())
|
if (*time < state->LastEventTime())
|
||||||
|
|||||||
@@ -58,25 +58,25 @@ public:
|
|||||||
|
|
||||||
void LoadingFinished();
|
void LoadingFinished();
|
||||||
|
|
||||||
inline bigtime_t BaseTime() const;
|
inline nanotime_t BaseTime() const;
|
||||||
void SetBaseTime(bigtime_t time);
|
void SetBaseTime(nanotime_t time);
|
||||||
|
|
||||||
inline bigtime_t LastEventTime() const;
|
inline nanotime_t LastEventTime() const;
|
||||||
void SetLastEventTime(bigtime_t time);
|
void SetLastEventTime(nanotime_t time);
|
||||||
|
|
||||||
int32 CountTeams() const;
|
int32 CountTeams() const;
|
||||||
Team* TeamAt(int32 index) const;
|
Team* TeamAt(int32 index) const;
|
||||||
Team* TeamByID(team_id id) const;
|
Team* TeamByID(team_id id) const;
|
||||||
Team* AddTeam(
|
Team* AddTeam(
|
||||||
const system_profiler_team_added* event,
|
const system_profiler_team_added* event,
|
||||||
bigtime_t time);
|
nanotime_t time);
|
||||||
|
|
||||||
int32 CountThreads() const;
|
int32 CountThreads() const;
|
||||||
Thread* ThreadAt(int32 index) const;
|
Thread* ThreadAt(int32 index) const;
|
||||||
Thread* ThreadByID(thread_id id) const;
|
Thread* ThreadByID(thread_id id) const;
|
||||||
Thread* AddThread(
|
Thread* AddThread(
|
||||||
const system_profiler_thread_added* event,
|
const system_profiler_thread_added* event,
|
||||||
bigtime_t time);
|
nanotime_t time);
|
||||||
|
|
||||||
WaitObject* AddWaitObject(
|
WaitObject* AddWaitObject(
|
||||||
const system_profiler_wait_object_info*
|
const system_profiler_wait_object_info*
|
||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
off_t eventOffset);
|
off_t eventOffset);
|
||||||
// must be added in order (of time)
|
// must be added in order (of time)
|
||||||
const CompactSchedulingState* ClosestSchedulingState(
|
const CompactSchedulingState* ClosestSchedulingState(
|
||||||
bigtime_t eventTime) const;
|
nanotime_t eventTime) const;
|
||||||
// returns the closest previous state
|
// returns the closest previous state
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -111,15 +111,15 @@ private:
|
|||||||
typedef BObjectList<CompactSchedulingState> SchedulingStateList;
|
typedef BObjectList<CompactSchedulingState> SchedulingStateList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int _CompareEventTimeSchedulingState(const bigtime_t* time,
|
static int _CompareEventTimeSchedulingState(const nanotime_t* time,
|
||||||
const CompactSchedulingState* state);
|
const CompactSchedulingState* state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BString fDataSourceName;
|
BString fDataSourceName;
|
||||||
void* fEventData;
|
void* fEventData;
|
||||||
size_t fEventDataSize;
|
size_t fEventDataSize;
|
||||||
bigtime_t fBaseTime;
|
nanotime_t fBaseTime;
|
||||||
bigtime_t fLastEventTime;
|
nanotime_t fLastEventTime;
|
||||||
TeamList fTeams; // sorted by ID
|
TeamList fTeams; // sorted by ID
|
||||||
ThreadList fThreads; // sorted by ID
|
ThreadList fThreads; // sorted by ID
|
||||||
WaitObjectGroupList fWaitObjectGroups;
|
WaitObjectGroupList fWaitObjectGroups;
|
||||||
@@ -128,7 +128,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
struct Model::creation_time_id {
|
struct Model::creation_time_id {
|
||||||
bigtime_t time;
|
nanotime_t time;
|
||||||
thread_id id;
|
thread_id id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,9 +152,9 @@ public:
|
|||||||
inline addr_t ReferencedObject();
|
inline addr_t ReferencedObject();
|
||||||
|
|
||||||
inline int64 Waits() const;
|
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,
|
static inline int CompareByTypeObject(const WaitObject* a,
|
||||||
const WaitObject* b);
|
const WaitObject* b);
|
||||||
@@ -167,7 +167,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int64 fWaits;
|
int64 fWaits;
|
||||||
bigtime_t fTotalWaitTime;
|
nanotime_t fTotalWaitTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ public:
|
|||||||
inline const char* Name() const;
|
inline const char* Name() const;
|
||||||
|
|
||||||
int64 Waits();
|
int64 Waits();
|
||||||
bigtime_t TotalWaitTime();
|
nanotime_t TotalWaitTime();
|
||||||
|
|
||||||
inline WaitObject* MostRecentWaitObject() const;
|
inline WaitObject* MostRecentWaitObject() const;
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
WaitObjectList fWaitObjects;
|
WaitObjectList fWaitObjects;
|
||||||
int64 fWaits;
|
int64 fWaits;
|
||||||
bigtime_t fTotalWaitTime;
|
nanotime_t fTotalWaitTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -222,14 +222,14 @@ public:
|
|||||||
inline addr_t ReferencedObject();
|
inline addr_t ReferencedObject();
|
||||||
|
|
||||||
inline int64 Waits() const;
|
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:
|
private:
|
||||||
WaitObject* fWaitObject;
|
WaitObject* fWaitObject;
|
||||||
int64 fWaits;
|
int64 fWaits;
|
||||||
bigtime_t fTotalWaitTime;
|
nanotime_t fTotalWaitTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -266,18 +266,18 @@ private:
|
|||||||
class Model::Team {
|
class Model::Team {
|
||||||
public:
|
public:
|
||||||
Team(const system_profiler_team_added* event,
|
Team(const system_profiler_team_added* event,
|
||||||
bigtime_t time);
|
nanotime_t time);
|
||||||
~Team();
|
~Team();
|
||||||
|
|
||||||
inline team_id ID() const;
|
inline team_id ID() const;
|
||||||
inline const char* Name() const;
|
inline const char* Name() const;
|
||||||
|
|
||||||
inline bigtime_t CreationTime() const;
|
inline nanotime_t CreationTime() const;
|
||||||
inline bigtime_t DeletionTime() const;
|
inline nanotime_t DeletionTime() const;
|
||||||
|
|
||||||
bool AddThread(Thread* thread);
|
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 CompareByID(const Team* a, const Team* b);
|
||||||
static inline int CompareWithID(const team_id* id,
|
static inline int CompareWithID(const team_id* id,
|
||||||
@@ -288,8 +288,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const system_profiler_team_added* fCreationEvent;
|
const system_profiler_team_added* fCreationEvent;
|
||||||
bigtime_t fCreationTime;
|
nanotime_t fCreationTime;
|
||||||
bigtime_t fDeletionTime;
|
nanotime_t fDeletionTime;
|
||||||
ThreadList fThreads; // sorted by creation time, ID
|
ThreadList fThreads; // sorted by creation time, ID
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ class Model::Thread {
|
|||||||
public:
|
public:
|
||||||
Thread(Team* team,
|
Thread(Team* team,
|
||||||
const system_profiler_thread_added* event,
|
const system_profiler_thread_added* event,
|
||||||
bigtime_t time);
|
nanotime_t time);
|
||||||
~Thread();
|
~Thread();
|
||||||
|
|
||||||
inline thread_id ID() const;
|
inline thread_id ID() const;
|
||||||
@@ -308,33 +308,33 @@ public:
|
|||||||
inline int32 Index() const;
|
inline int32 Index() const;
|
||||||
inline void SetIndex(int32 index);
|
inline void SetIndex(int32 index);
|
||||||
|
|
||||||
inline bigtime_t CreationTime() const;
|
inline nanotime_t CreationTime() const;
|
||||||
inline bigtime_t DeletionTime() const;
|
inline nanotime_t DeletionTime() const;
|
||||||
|
|
||||||
inline int64 Runs() const;
|
inline int64 Runs() const;
|
||||||
inline bigtime_t TotalRunTime() const;
|
inline nanotime_t TotalRunTime() const;
|
||||||
inline int64 Reruns() const;
|
inline int64 Reruns() const;
|
||||||
inline bigtime_t TotalRerunTime() const;
|
inline nanotime_t TotalRerunTime() const;
|
||||||
inline int64 Latencies() const;
|
inline int64 Latencies() const;
|
||||||
inline bigtime_t TotalLatency() const;
|
inline nanotime_t TotalLatency() const;
|
||||||
inline int64 Preemptions() const;
|
inline int64 Preemptions() const;
|
||||||
inline int64 Waits() const;
|
inline int64 Waits() const;
|
||||||
inline bigtime_t TotalWaitTime() const;
|
inline nanotime_t TotalWaitTime() const;
|
||||||
inline bigtime_t UnspecifiedWaitTime() const;
|
inline nanotime_t UnspecifiedWaitTime() const;
|
||||||
|
|
||||||
ThreadWaitObjectGroup* ThreadWaitObjectGroupFor(uint32 type,
|
ThreadWaitObjectGroup* ThreadWaitObjectGroupFor(uint32 type,
|
||||||
addr_t object) const;
|
addr_t object) const;
|
||||||
inline int32 CountThreadWaitObjectGroups() const;
|
inline int32 CountThreadWaitObjectGroups() const;
|
||||||
inline ThreadWaitObjectGroup* ThreadWaitObjectGroupAt(int32 index) 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 AddRun(nanotime_t runTime);
|
||||||
void AddRerun(bigtime_t runTime);
|
void AddRerun(nanotime_t runTime);
|
||||||
void AddLatency(bigtime_t latency);
|
void AddLatency(nanotime_t latency);
|
||||||
void AddPreemption(bigtime_t runTime);
|
void AddPreemption(nanotime_t runTime);
|
||||||
void AddWait(bigtime_t waitTime);
|
void AddWait(nanotime_t waitTime);
|
||||||
void AddUnspecifiedWait(bigtime_t waitTime);
|
void AddUnspecifiedWait(nanotime_t waitTime);
|
||||||
|
|
||||||
ThreadWaitObject* AddThreadWaitObject(WaitObject* waitObject,
|
ThreadWaitObject* AddThreadWaitObject(WaitObject* waitObject,
|
||||||
ThreadWaitObjectGroup**
|
ThreadWaitObjectGroup**
|
||||||
@@ -357,27 +357,27 @@ private:
|
|||||||
private:
|
private:
|
||||||
Team* fTeam;
|
Team* fTeam;
|
||||||
const system_profiler_thread_added* fCreationEvent;
|
const system_profiler_thread_added* fCreationEvent;
|
||||||
bigtime_t fCreationTime;
|
nanotime_t fCreationTime;
|
||||||
bigtime_t fDeletionTime;
|
nanotime_t fDeletionTime;
|
||||||
|
|
||||||
int64 fRuns;
|
int64 fRuns;
|
||||||
bigtime_t fTotalRunTime;
|
nanotime_t fTotalRunTime;
|
||||||
bigtime_t fMinRunTime;
|
nanotime_t fMinRunTime;
|
||||||
bigtime_t fMaxRunTime;
|
nanotime_t fMaxRunTime;
|
||||||
|
|
||||||
int64 fLatencies;
|
int64 fLatencies;
|
||||||
bigtime_t fTotalLatency;
|
nanotime_t fTotalLatency;
|
||||||
bigtime_t fMinLatency;
|
nanotime_t fMinLatency;
|
||||||
bigtime_t fMaxLatency;
|
nanotime_t fMaxLatency;
|
||||||
|
|
||||||
int64 fReruns;
|
int64 fReruns;
|
||||||
bigtime_t fTotalRerunTime;
|
nanotime_t fTotalRerunTime;
|
||||||
bigtime_t fMinRerunTime;
|
nanotime_t fMinRerunTime;
|
||||||
bigtime_t fMaxRerunTime;
|
nanotime_t fMaxRerunTime;
|
||||||
|
|
||||||
int64 fWaits;
|
int64 fWaits;
|
||||||
bigtime_t fTotalWaitTime;
|
nanotime_t fTotalWaitTime;
|
||||||
bigtime_t fUnspecifiedWaitTime;
|
nanotime_t fUnspecifiedWaitTime;
|
||||||
|
|
||||||
int64 fPreemptions;
|
int64 fPreemptions;
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
struct Model::CompactThreadSchedulingState {
|
struct Model::CompactThreadSchedulingState {
|
||||||
bigtime_t lastTime;
|
nanotime_t lastTime;
|
||||||
Model::Thread* thread;
|
Model::Thread* thread;
|
||||||
ThreadWaitObject* waitObject;
|
ThreadWaitObject* waitObject;
|
||||||
ThreadState state;
|
ThreadState state;
|
||||||
@@ -438,8 +438,8 @@ public:
|
|||||||
status_t Init(const CompactSchedulingState* state);
|
status_t Init(const CompactSchedulingState* state);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
inline bigtime_t LastEventTime() const { return fLastEventTime; }
|
inline nanotime_t LastEventTime() const { return fLastEventTime; }
|
||||||
inline void SetLastEventTime(bigtime_t time);
|
inline void SetLastEventTime(nanotime_t time);
|
||||||
|
|
||||||
inline ThreadSchedulingState* LookupThread(thread_id threadID) const;
|
inline ThreadSchedulingState* LookupThread(thread_id threadID) const;
|
||||||
inline void InsertThread(ThreadSchedulingState* thread);
|
inline void InsertThread(ThreadSchedulingState* thread);
|
||||||
@@ -447,7 +447,7 @@ public:
|
|||||||
inline const ThreadSchedulingStateTable& ThreadStates() const;
|
inline const ThreadSchedulingStateTable& ThreadStates() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bigtime_t fLastEventTime;
|
nanotime_t fLastEventTime;
|
||||||
ThreadSchedulingStateTable fThreadStates;
|
ThreadSchedulingStateTable fThreadStates;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ public:
|
|||||||
void Delete();
|
void Delete();
|
||||||
|
|
||||||
inline off_t EventOffset() const;
|
inline off_t EventOffset() const;
|
||||||
inline bigtime_t LastEventTime() const;
|
inline nanotime_t LastEventTime() const;
|
||||||
|
|
||||||
inline int32 CountThreadsStates() const;
|
inline int32 CountThreadsStates() const;
|
||||||
inline const CompactThreadSchedulingState* ThreadStateAt(int32 index)
|
inline const CompactThreadSchedulingState* ThreadStateAt(int32 index)
|
||||||
@@ -474,7 +474,7 @@ private:
|
|||||||
inline ~CompactSchedulingState() {}
|
inline ~CompactSchedulingState() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bigtime_t fLastEventTime;
|
nanotime_t fLastEventTime;
|
||||||
off_t fEventOffset;
|
off_t fEventOffset;
|
||||||
int32 fThreadCount;
|
int32 fThreadCount;
|
||||||
CompactThreadSchedulingState fThreadStates[0];
|
CompactThreadSchedulingState fThreadStates[0];
|
||||||
@@ -505,14 +505,14 @@ Model::EventDataSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::BaseTime() const
|
Model::BaseTime() const
|
||||||
{
|
{
|
||||||
return fBaseTime;
|
return fBaseTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::LastEventTime() const
|
Model::LastEventTime() const
|
||||||
{
|
{
|
||||||
return fLastEventTime;
|
return fLastEventTime;
|
||||||
@@ -557,7 +557,7 @@ Model::WaitObject::Waits() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::WaitObject::TotalWaitTime() const
|
Model::WaitObject::TotalWaitTime() const
|
||||||
{
|
{
|
||||||
return fTotalWaitTime;
|
return fTotalWaitTime;
|
||||||
@@ -704,7 +704,7 @@ Model::ThreadWaitObject::Waits() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::ThreadWaitObject::TotalWaitTime() const
|
Model::ThreadWaitObject::TotalWaitTime() const
|
||||||
{
|
{
|
||||||
return fTotalWaitTime;
|
return fTotalWaitTime;
|
||||||
@@ -771,14 +771,14 @@ Model::Team::Name() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Team::CreationTime() const
|
Model::Team::CreationTime() const
|
||||||
{
|
{
|
||||||
return fCreationTime;
|
return fCreationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Team::DeletionTime() const
|
Model::Team::DeletionTime() const
|
||||||
{
|
{
|
||||||
return fDeletionTime;
|
return fDeletionTime;
|
||||||
@@ -786,7 +786,7 @@ Model::Team::DeletionTime() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Team::SetDeletionTime(bigtime_t time)
|
Model::Team::SetDeletionTime(nanotime_t time)
|
||||||
{
|
{
|
||||||
fDeletionTime = time;
|
fDeletionTime = time;
|
||||||
}
|
}
|
||||||
@@ -830,14 +830,14 @@ Model::Thread::GetTeam() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::CreationTime() const
|
Model::Thread::CreationTime() const
|
||||||
{
|
{
|
||||||
return fCreationTime;
|
return fCreationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::DeletionTime() const
|
Model::Thread::DeletionTime() const
|
||||||
{
|
{
|
||||||
return fDeletionTime;
|
return fDeletionTime;
|
||||||
@@ -865,7 +865,7 @@ Model::Thread::Runs() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::TotalRunTime() const
|
Model::Thread::TotalRunTime() const
|
||||||
{
|
{
|
||||||
return fTotalRunTime;
|
return fTotalRunTime;
|
||||||
@@ -879,7 +879,7 @@ Model::Thread::Reruns() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::TotalRerunTime() const
|
Model::Thread::TotalRerunTime() const
|
||||||
{
|
{
|
||||||
return fTotalRerunTime;
|
return fTotalRerunTime;
|
||||||
@@ -893,7 +893,7 @@ Model::Thread::Latencies() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::TotalLatency() const
|
Model::Thread::TotalLatency() const
|
||||||
{
|
{
|
||||||
return fTotalLatency;
|
return fTotalLatency;
|
||||||
@@ -914,14 +914,14 @@ Model::Thread::Waits() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::TotalWaitTime() const
|
Model::Thread::TotalWaitTime() const
|
||||||
{
|
{
|
||||||
return fTotalWaitTime;
|
return fTotalWaitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::Thread::UnspecifiedWaitTime() const
|
Model::Thread::UnspecifiedWaitTime() const
|
||||||
{
|
{
|
||||||
return fUnspecifiedWaitTime;
|
return fUnspecifiedWaitTime;
|
||||||
@@ -943,7 +943,7 @@ Model::Thread::ThreadWaitObjectGroupAt(int32 index) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::Thread::SetDeletionTime(bigtime_t time)
|
Model::Thread::SetDeletionTime(nanotime_t time)
|
||||||
{
|
{
|
||||||
fDeletionTime = time;
|
fDeletionTime = time;
|
||||||
}
|
}
|
||||||
@@ -977,7 +977,7 @@ Model::Thread::CompareByCreationTimeID(const Thread* a, const Thread* b)
|
|||||||
Model::Thread::CompareWithCreationTimeID(const creation_time_id* key,
|
Model::Thread::CompareWithCreationTimeID(const creation_time_id* key,
|
||||||
const Thread* thread)
|
const Thread* thread)
|
||||||
{
|
{
|
||||||
bigtime_t cmp = key->time - thread->fCreationTime;
|
nanotime_t cmp = key->time - thread->fCreationTime;
|
||||||
if (cmp == 0)
|
if (cmp == 0)
|
||||||
return key->id - thread->ID();
|
return key->id - thread->ID();
|
||||||
return cmp < 0 ? -1 : 1;
|
return cmp < 0 ? -1 : 1;
|
||||||
@@ -1029,7 +1029,7 @@ Model::SchedulingState::SchedulingState()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SchedulingState::SetLastEventTime(bigtime_t time)
|
Model::SchedulingState::SetLastEventTime(nanotime_t time)
|
||||||
{
|
{
|
||||||
fLastEventTime = time;
|
fLastEventTime = time;
|
||||||
}
|
}
|
||||||
@@ -1073,7 +1073,7 @@ Model::CompactSchedulingState::EventOffset() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
Model::CompactSchedulingState::LastEventTime() const
|
Model::CompactSchedulingState::LastEventTime() const
|
||||||
{
|
{
|
||||||
return fLastEventTime;
|
return fLastEventTime;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ThreadModel.h"
|
#include "ThreadModel.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -93,7 +94,7 @@ ThreadModel::AddSchedulingEvent(const system_profiler_event_header* eventHeader)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
ThreadModel::FindSchedulingEvent(bigtime_t time)
|
ThreadModel::FindSchedulingEvent(nanotime_t time)
|
||||||
{
|
{
|
||||||
if (time < 0)
|
if (time < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifndef THREAD_MODEL_H
|
#ifndef THREAD_MODEL_H
|
||||||
#define THREAD_MODEL_H
|
#define THREAD_MODEL_H
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "Model.h"
|
#include "Model.h"
|
||||||
@@ -36,7 +37,7 @@ public:
|
|||||||
inline int32 CountSchedulingEvents() const;
|
inline int32 CountSchedulingEvents() const;
|
||||||
inline const system_profiler_event_header* SchedulingEventAt(
|
inline const system_profiler_event_header* SchedulingEventAt(
|
||||||
int32 index) const;
|
int32 index) const;
|
||||||
int32 FindSchedulingEvent(bigtime_t time);
|
int32 FindSchedulingEvent(nanotime_t time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BObjectList<WaitObjectGroup> WaitObjectGroupList;
|
typedef BObjectList<WaitObjectGroup> WaitObjectGroupList;
|
||||||
@@ -67,7 +68,7 @@ public:
|
|||||||
inline const char* Name() const;
|
inline const char* Name() const;
|
||||||
|
|
||||||
inline int64 Waits() const;
|
inline int64 Waits() const;
|
||||||
inline bigtime_t TotalWaitTime() const;
|
inline nanotime_t TotalWaitTime() const;
|
||||||
|
|
||||||
inline int32 CountWaitObjects() const;
|
inline int32 CountWaitObjects() const;
|
||||||
inline Model::ThreadWaitObject* WaitObjectAt(int32 index) const;
|
inline Model::ThreadWaitObject* WaitObjectAt(int32 index) const;
|
||||||
@@ -82,7 +83,7 @@ private:
|
|||||||
Model::ThreadWaitObject** fWaitObjects;
|
Model::ThreadWaitObject** fWaitObjects;
|
||||||
int32 fCount;
|
int32 fCount;
|
||||||
int64 fWaits;
|
int64 fWaits;
|
||||||
bigtime_t fTotalWaitTime;
|
nanotime_t fTotalWaitTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -141,7 +142,7 @@ ThreadModel::WaitObjectGroup::Waits() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
nanotime_t
|
||||||
ThreadModel::WaitObjectGroup::TotalWaitTime() const
|
ThreadModel::WaitObjectGroup::TotalWaitTime() const
|
||||||
{
|
{
|
||||||
return fTotalWaitTime;
|
return fTotalWaitTime;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ static const SimpleWaitObjectInfo kSignalWaitObjectInfo(
|
|||||||
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
ModelLoader::_UpdateLastEventTime(bigtime_t time)
|
ModelLoader::_UpdateLastEventTime(nanotime_t time)
|
||||||
{
|
{
|
||||||
if (fBaseTime < 0) {
|
if (fBaseTime < 0) {
|
||||||
fBaseTime = time;
|
fBaseTime = time;
|
||||||
@@ -392,7 +392,7 @@ ModelLoader::_HandleThreadScheduled(system_profiler_thread_scheduled* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bigtime_t diffTime = fState.LastEventTime() - thread->lastTime;
|
nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
|
||||||
|
|
||||||
if (thread->state == READY) {
|
if (thread->state == READY) {
|
||||||
// thread scheduled after having been woken up
|
// thread scheduled after having been woken up
|
||||||
@@ -493,7 +493,7 @@ ModelLoader::_HandleThreadEnqueuedInRunQueue(
|
|||||||
thread->state = STILL_RUNNING;
|
thread->state = STILL_RUNNING;
|
||||||
} else {
|
} else {
|
||||||
// Thread was waiting and is ready now.
|
// 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) {
|
if (thread->waitObject != NULL) {
|
||||||
thread->waitObject->AddWait(diffTime);
|
thread->waitObject->AddWait(diffTime);
|
||||||
thread->waitObject = NULL;
|
thread->waitObject = NULL;
|
||||||
@@ -523,7 +523,7 @@ ModelLoader::_HandleThreadRemovedFromRunQueue(
|
|||||||
// This really only happens when the thread priority is changed
|
// This really only happens when the thread priority is changed
|
||||||
// while the thread is ready.
|
// while the thread is ready.
|
||||||
|
|
||||||
bigtime_t diffTime = fState.LastEventTime() - thread->lastTime;
|
nanotime_t diffTime = fState.LastEventTime() - thread->lastTime;
|
||||||
if (thread->state == RUNNING) {
|
if (thread->state == RUNNING) {
|
||||||
// This should never happen.
|
// This should never happen.
|
||||||
thread->thread->AddRun(diffTime);
|
thread->thread->AddRun(diffTime);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ private:
|
|||||||
status_t _ProcessEvent(uint32 event, uint32 cpu,
|
status_t _ProcessEvent(uint32 event, uint32 cpu,
|
||||||
const void* buffer, size_t size);
|
const void* buffer, size_t size);
|
||||||
|
|
||||||
inline void _UpdateLastEventTime(bigtime_t time);
|
inline void _UpdateLastEventTime(nanotime_t time);
|
||||||
|
|
||||||
void _HandleTeamAdded(
|
void _HandleTeamAdded(
|
||||||
system_profiler_team_added* event);
|
system_profiler_team_added* event);
|
||||||
@@ -76,7 +76,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
Model* fModel;
|
Model* fModel;
|
||||||
DataSource* fDataSource;
|
DataSource* fDataSource;
|
||||||
bigtime_t fBaseTime;
|
nanotime_t fBaseTime;
|
||||||
Model::SchedulingState fState;
|
Model::SchedulingState fState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <system_profiler.h>
|
#include <system_profiler.h>
|
||||||
|
|
||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
@@ -627,7 +628,7 @@ SystemProfiler::ThreadEnqueuedInRunQueue(struct thread* thread)
|
|||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event->time = system_time();
|
event->time = system_time_nsecs();
|
||||||
event->thread = thread->id;
|
event->thread = thread->id;
|
||||||
event->priority = thread->priority;
|
event->priority = thread->priority;
|
||||||
|
|
||||||
@@ -658,7 +659,7 @@ SystemProfiler::ThreadRemovedFromRunQueue(struct thread* thread)
|
|||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event->time = system_time();
|
event->time = system_time_nsecs();
|
||||||
event->thread = thread->id;
|
event->thread = thread->id;
|
||||||
|
|
||||||
fHeader->size = fBufferSize;
|
fHeader->size = fBufferSize;
|
||||||
@@ -688,7 +689,7 @@ SystemProfiler::ThreadScheduled(struct thread* oldThread,
|
|||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event->time = system_time();
|
event->time = system_time_nsecs();
|
||||||
event->thread = newThread->id;
|
event->thread = newThread->id;
|
||||||
event->previous_thread = oldThread->id;
|
event->previous_thread = oldThread->id;
|
||||||
event->previous_thread_state = oldThread->state;
|
event->previous_thread_state = oldThread->state;
|
||||||
|
|||||||
Reference in New Issue
Block a user