kernel: profile system when SYSTEM_PROFILER is defined.
* This enables a mechanism to profile almost the complete boot process (starting with main2()), if SYSTEM_PROFILER is defined to 1. * You can access the profiling data using "profile -r".
This commit is contained in:
@@ -133,5 +133,11 @@
|
|||||||
// Enables tracking of page allocations.
|
// Enables tracking of page allocations.
|
||||||
#define VM_PAGE_ALLOCATION_TRACKING 0
|
#define VM_PAGE_ALLOCATION_TRACKING 0
|
||||||
|
|
||||||
|
// Enables the (boot) system profiler for use with "profile -r"
|
||||||
|
#define SYSTEM_PROFILER 0
|
||||||
|
#define SYSTEM_PROFILE_SIZE 40 * 1024 * 1024
|
||||||
|
#define SYSTEM_PROFILE_STACK_DEPTH 10
|
||||||
|
#define SYSTEM_PROFILE_INTERVAL 10000
|
||||||
|
|
||||||
|
|
||||||
#endif // KERNEL_DEBUG_CONFIG_H
|
#endif // KERNEL_DEBUG_CONFIG_H
|
||||||
|
|||||||
@@ -9,15 +9,19 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include "kernel_debug_config.h"
|
||||||
|
|
||||||
|
|
||||||
struct system_profiler_parameters;
|
struct system_profiler_parameters;
|
||||||
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#if SYSTEM_PROFILER
|
||||||
status_t start_system_profiler(size_t areaSize, uint32 stackDepth,
|
status_t start_system_profiler(size_t areaSize, uint32 stackDepth,
|
||||||
bigtime_t interval);
|
bigtime_t interval);
|
||||||
void stop_system_profiler();
|
void stop_system_profiler();
|
||||||
|
#endif
|
||||||
|
|
||||||
status_t _user_system_profiler_start(
|
status_t _user_system_profiler_start(
|
||||||
struct system_profiler_parameters* parameters);
|
struct system_profiler_parameters* parameters);
|
||||||
|
|||||||
@@ -1435,6 +1435,8 @@ SystemProfiler::_ProfilingEvent(struct timer* timer)
|
|||||||
// #pragma mark - private kernel API
|
// #pragma mark - private kernel API
|
||||||
|
|
||||||
|
|
||||||
|
#if SYSTEM_PROFILER
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
start_system_profiler(size_t areaSize, uint32 stackDepth, bigtime_t interval)
|
start_system_profiler(size_t areaSize, uint32 stackDepth, bigtime_t interval)
|
||||||
{
|
{
|
||||||
@@ -1530,6 +1532,8 @@ stop_system_profiler()
|
|||||||
profiler->ReleaseReference();
|
profiler->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // SYSTEM_PROFILER
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - syscalls
|
// #pragma mark - syscalls
|
||||||
|
|
||||||
@@ -1644,13 +1648,16 @@ _user_system_profiler_stop()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
_user_system_profiler_recorded(struct system_profiler_parameters* userParameters)
|
_user_system_profiler_recorded(system_profiler_parameters* userParameters)
|
||||||
{
|
{
|
||||||
if (userParameters == NULL || !IS_USER_ADDRESS(userParameters))
|
if (userParameters == NULL || !IS_USER_ADDRESS(userParameters))
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
if (sRecordedParameters == NULL)
|
if (sRecordedParameters == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
#if SYSTEM_PROFILER
|
||||||
|
stop_system_profiler();
|
||||||
|
|
||||||
// Transfer the area to the userland process
|
// Transfer the area to the userland process
|
||||||
|
|
||||||
void* address;
|
void* address;
|
||||||
@@ -1673,4 +1680,7 @@ _user_system_profiler_recorded(struct system_profiler_parameters* userParameters
|
|||||||
sRecordedParameters = NULL;
|
sRecordedParameters = NULL;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
#else
|
||||||
|
return B_NOT_SUPPORTED;
|
||||||
|
#endif // SYSTEM_PROFILER
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2002-2015, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <real_time_clock.h>
|
#include <real_time_clock.h>
|
||||||
#include <sem.h>
|
#include <sem.h>
|
||||||
#include <smp.h>
|
#include <smp.h>
|
||||||
|
#include <system_profiler.h>
|
||||||
#include <team.h>
|
#include <team.h>
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
#include <user_debugger.h>
|
#include <user_debugger.h>
|
||||||
@@ -273,12 +274,14 @@ _start(kernel_args *bootKernelArgs, int currentCPU)
|
|||||||
|
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
main2(void *unused)
|
main2(void* /*unused*/)
|
||||||
{
|
{
|
||||||
(void)(unused);
|
|
||||||
|
|
||||||
TRACE("start of main2: initializing devices\n");
|
TRACE("start of main2: initializing devices\n");
|
||||||
|
|
||||||
|
#if SYSTEM_PROFILER
|
||||||
|
start_system_profiler(SYSTEM_PROFILE_SIZE, SYSTEM_PROFILE_STACK_DEPTH,
|
||||||
|
SYSTEM_PROFILE_INTERVAL);
|
||||||
|
#endif
|
||||||
boot_splash_init(sKernelArgs.boot_splash);
|
boot_splash_init(sKernelArgs.boot_splash);
|
||||||
|
|
||||||
commpage_init_post_cpus();
|
commpage_init_post_cpus();
|
||||||
|
|||||||
Reference in New Issue
Block a user