* Model: Added class IOScheduler, a list of IOSchedulers, and a methods to

access it.
* ModelLoader:
  - Also add IOSchedulers to the model.
  - Sort the per thread list of IORequests by start time.
  - Added a bit of output in the _HandleIO*() methods when we don't know a
    request or operation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34738 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-12-21 21:05:36 +00:00
parent 1c12dcb598
commit 934a8d0113
4 changed files with 172 additions and 5 deletions
@@ -708,8 +708,12 @@ ModelLoader::_ProcessEvent(uint32 event, uint32 cpu, const void* buffer,
break;
case B_SYSTEM_PROFILER_IO_SCHEDULER_ADDED:
_HandleIOSchedulerAdded(
(system_profiler_io_scheduler_added*)buffer);
break;
case B_SYSTEM_PROFILER_IO_SCHEDULER_REMOVED:
// TODO: Handle!
// not so interesting
break;
case B_SYSTEM_PROFILER_IO_REQUEST_SCHEDULED:
@@ -872,6 +876,9 @@ ModelLoader::_SetThreadIORequests(Model::Thread* thread,
ioCount++;
ioTime += previousEnd - ioStart;
// sort requests by start time
std::sort(requests, requests + requestCount, Model::IORequest::TimeLess);
// set the computed values
thread->SetIORequests(requests, requestCount);
thread->SetIOs(ioCount, ioTime);
@@ -1108,6 +1115,21 @@ ModelLoader::_HandleWaitObjectInfo(system_profiler_wait_object_info* event)
}
void
ModelLoader::_HandleIOSchedulerAdded(system_profiler_io_scheduler_added* event)
{
Model::IOScheduler* scheduler = fModel->IOSchedulerByID(event->scheduler);
if (scheduler != NULL) {
printf("Duplicate added event for I/O scheduler %ld\n",
event->scheduler);
return;
}
if (fModel->AddIOScheduler(event) == NULL)
throw std::bad_alloc();
}
void
ModelLoader::_HandleIORequestScheduled(io_request_scheduled* event)
{
@@ -1123,6 +1145,11 @@ ModelLoader::_HandleIORequestScheduled(io_request_scheduled* event)
return;
}
if (fModel->IOSchedulerByID(event->scheduler) == NULL) {
printf("I/O requests for unknown scheduler %ld\n", event->scheduler);
return;
}
request = new(std::nothrow) IORequest(event);
if (request == NULL)
throw std::bad_alloc();
@@ -1151,8 +1178,11 @@ void
ModelLoader::_HandleIOOperationStarted(io_operation_started* event)
{
IORequest* request = fIORequests->Lookup(event->request);
if (request == NULL)
if (request == NULL) {
printf("ModelLoader::_HandleIOOperationStarted(): I/O request for operation %p not found\n",
event->operation);
return;
}
IOOperation* operation = new(std::nothrow) IOOperation(event);
if (operation == NULL)
@@ -1166,12 +1196,18 @@ void
ModelLoader::_HandleIOOperationFinished(io_operation_finished* event)
{
IORequest* request = fIORequests->Lookup(event->request);
if (request == NULL)
if (request == NULL) {
printf("ModelLoader::_HandleIOOperationFinished(): I/O request for "
"operation %p not found\n", event->operation);
return;
}
IOOperation* operation = request->FindOperation(event->operation);
if (operation == NULL)
if (operation == NULL) {
printf("ModelLoader::_HandleIOOperationFinished(): operation %p not "
"found\n", event->operation);
return;
}
operation->finishedEvent = event;
}