History log of /haiku/src/system/kernel/debug/system_profiler.cpp
Revision Date Author Comments
# 557f0446 26-Apr-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Introduce THREAD_BLOCK_TYPE_OTHER_OBJECT.

THREAD_BLOCK_TYPE_OTHER implies the "object" pointer in the
wait information is a string. But sometimes we want to pass
through objects which are not strings, for inspection in KDL.


# 057fe191 01-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Break thread-related AutoLockers into a separate header.

Including thread.h brings a massive array of things with it from
the kernel thread arch headers, team and thread definitions,
hash tables, linked lists, Referenceable, etc. that the vast majority
of AutoLock.h consumers neither want nor need.

So, put these in a separate header, and adjust all consumers of these
lockers to include the new file.

This change exposes the fact that a lot of files were inadvertently
making use of headers included indirectly through thread.h. Those
will be fixed in the next commit.


# 46ab6b29 19-Feb-2020 Augustin Cavalier <waddlesplash@gmail.com>

kernel/debug: Zero-initialize droppedEvents.

There is a case where NextBuffer can return B_OK without initializing
droppedEvents, so make sure we do that here.


# 2d85a564 27-Sep-2019 Kacper Kasper <kacperkasper@gmail.com>

Fix SMAP violation when running profile

* Fixes #15379.

Change-Id: I3d5672ec0ffd4c09a35535f641e433d3d714412a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1890
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 6f6cba7c 04-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/system_profiler: Do not allow non-root users access.

The single-team profiler can still be used without root access.
Part of #14961.


# fb7498fe 10-Mar-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

system profiler: revert use of BytePointer.

This went through review way too fast once again. I did warn that these
changes were completely untested, and indeed this one was broken. Be
very careful when pressing the submit button, please!

Change-Id: I6e0230efe94830033f5427451f67fe6ce29a28e6
Reviewed-on: https://review.haiku-os.org/c/1184
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 5bf19df2 23-Feb-2019 PulkoMandy <pulkomandy@pulkomandy.tk>

system profiler: use BytePointer

Change-Id: I297edd8aa5f2d8d35af660d557a2c78d68afab97
Reviewed-on: https://review.haiku-os.org/c/1092
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# bec80c1c 10-Feb-2018 Jérôme Duval <jerome.duval@gmail.com>

white space cleanup


# 5c821d12 22-Nov-2017 Julian Harnath <julian.harnath@rwth-aachen.de>

SystemProfiler: prevent nested wake-up of profiler thread

* When SystemProfiler::_MaybeNotifyProfilerThreadLocked() is called
and the conditions are right, it will lock the thread's scheduler
spinlock and unblock it. Internally, the unblock will enqueue the
thread into the run queue, which causes a ThreadEnqueuedInRunQueue
event for SystemProfiler. Since the conditions haven't changed, it
now went into _MaybeNotifyProfilerThreadLocked again (this time
from the profiler thread context). In there, it will try to lock
the profiler thread's scheduling spinlock, which is already locked
by the other thread (which is firmly sleeping). Deadlock, KDL.

* Before unblocking the profiler thread, unset fWaitingProfilerThread
so that further events will not try to unblock it again.


# 8c6cb8af 26-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

runtime loader: Register extended image info with kernel

Add structure extended_image_info which extends image_info by the
fields symbol_table, symbol_hash, string_table.


# 035e3e77 15-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

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".


# ad649430 26-Feb-2014 Julian Harnath <julian.harnath@rwth-aachen.de>

Fix spinlock usage in kernel's system profiling

* Removal of gSchedulerLock left a few SpinLockers around which were
now without locked interrupts.

* Makes scheduling_recorder work again.


# e6ea745e 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# 03fb2d88 07-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove gSchedulerLock

* Thread::scheduler_lock protects thread state, priority, etc.
* sThreadCreationLock protects thread creation and removal and list of
threads in team.
* Team::signal_lock and Team::time_lock protect list of threads in team
as well.
* Scheduler uses its own internal locking.


# c8dd9f77 29-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Add thread_unblock() and use it where possible


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 88e38c17 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replace uses of obsolescent BReference[able] API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39870 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7aba4e40 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved IOSchedulerRoster into its own header/source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36491 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e408737 31-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

SystemProfiler::EventOccurred(): We must not access the object after
releasing our reference to it. So return immediately after having done that.
Previously the _MaybeNotifyProfilerThread() that innocently lurked at the end
of the method would be invoked, playing with the dead beef.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35357 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8fc761bd 10-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Don't use a condition variable for blocking the system profiler thread, since
that causes a locking order reversal (condition variable lock <-> system
profiler lock) and thus a potential deadlock. Instead we use the thread
blocking API directly. Fixes #5229.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a38f8503 22-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* arch_debug_get_stack_trace():
- Replaced the "userOnly" parameter by a "flags" parameter, that allows to
specify kernel and userland stack traces individually.
- x86, m68k: Don't always skip the first frame as that prevents the caller
from being able to record its own address.
* capture_tracing_stack_trace(): Replaced the "userOnly" parameter by
"kernelOnly", since one is probably always interested in the kernel stack
trace, but might not want the userland stack trace.
* Added stack trace support for VM cache kernel tracing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34742 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 189010cb 19-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for I/O scheduling events to the system profiler interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34703 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d8d4b902 07-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# e50cf876 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9837ec16 20-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed spelling.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34144 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5147963d 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13aa1795 20-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* It seems we always have to specify all flags to make it work; removed "flags"
parameter from start_system_profiler().
* Added stack depth, and interval parameters to it, though.
* Profiling the boot process is now possible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24a9c1bb 20-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Added option "-r, --recorded" to profile: this will now retrieve the kernel
profile data area, and evaluate its data - it doesn't produce any output yet,
though.
* _user_system_profiler_recorded() now also makes sure the userland app can read
from the buffer area.
* Fixed leak in SharedImage::Init().
* Made the symbol retriever more smart when it deals with kernel images; if the
image ID is no longer available, it will now use the path based image symbol
iterator (and also adds the boot kernel path, in case the module don't have
one).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31653 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5fbad060 17-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Work-in-progress on a kernel profile service that can be evaluated from
userland afterwards.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31621 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 106fd6b5 24-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Make the wait object hash table larger than the maximum number of wait
objects we're going to add, so we get less slot collisions.
* Use the "Unchecked" versions of the OpenHashTable Insert()/Remove() methods,
since we have interrupts disabled.
* Fixed wrong check that caused the wait object info events not to be filled in.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30384 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 227fe7d3 23-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Scheduler/wait object listener:
- Moved scheduler listening interface to <listeners.h> and added more
convenient to use templatized notification functions.
- Added a listener mechanism for the wait objects (semaphores, condition
variables, mutex, rw_lock).
* system profiler:
- Hopefully fixed locking issues related to notifying the profiler thread
for good. We still had an inconsistent locking order, since the scheduler
notification callbacks are invoked with the thread lock held and have to
acquire the object lock then, while the other callbacks acquired the object
lock first and as a side effect of ConditionVariable::NotifyOne() acquired
the thread lock. Now we make sure the object lock is the innermost lock.
- Track the number of dropped events due to a full buffer.
_user_system_profiler_next_buffer() returns this count now.
- When scheduling profiling events are requested also listen to wait objects
and generate the respective profiling events. We send those events lazily
and cache the infos to avoid resending an event for the same wait object.
- When starting profiling we do now generate "thread scheduled" events for
the already running threads.
- _user_system_profiler_start(): Check whether the parameters pointer is a
userland address at all.
- The system_profiler_team_added event does now also contain the team's name.
* Added a sem_get_name_unsafe() returning a semaphore's name. It is "unsafe",
since the caller has to ensure that the semaphore exists and continues to
exist as long as the returned name is used.
* Adjusted the "profile" and "scheduling_recorder" according to the system
profiling changes. The latter prints the number of dropped events, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30345 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 146f113f 22-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed issues with the scheduling events. In the listener callbacks we
potentially want to notify the profiler thread (i.e. wake it up), which can
cause another scheduling event notification. That is we have to make sure that
event buffer is in a consistent state at that point (i.e. wake up the thread
at the very end of the callbacks). Furthermore the ThreadEnqueuedInRunQueue()
callback can be called with spinlocks besides the thread spinlock being held. In
particular waking up threads also happens in the condition variable code with
a static spinlock being held. Trying to notify the condition variable the
profiler thread is waiting on in such a case would be a guaranteed deadlock.
Hence we avoid doing that, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30339 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bc2e00c1 21-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_system_profiler_start(): Check the sampling related parameters only when
sampling is requested at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30294 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1cdc2fb6 19-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Align the entries in the event buffer to 4 bytes at least. Usually CPUs like
that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30272 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b2f0f33 18-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the interface of _kern_system_profiler_start(). The parameters are
passed in a structure now, so it is easier to extend it and ignore unused
parameters.
* One can now select which system profiling events one is interested in.
* Added scheduling events to the system profiling interface. Those are pretty
much the ones recorded when scheduler tracing is enabled. Still missing are
the "wait object" events that allow to interpret what a thread is waiting
for.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30243 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1b9d2885 16-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also pass the team arguments and thread names with the respective system
profiling events.
* profile: Avoid using get_{team,thread}_info() in common code paths. The
system profiling mode is asynchronous, so the team or thread in question
could already be gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30193 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e2ae69da 11-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

The kernel side of a new system-wide sampling-based profiling mechanism.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30127 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 035e3e77ed4550c9e9e5d932d02125be0d80d04c 15-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

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".


# ad64943039d06cec61ad282f935992908aa86b4e 26-Feb-2014 Julian Harnath <julian.harnath@rwth-aachen.de>

Fix spinlock usage in kernel's system profiling

* Removal of gSchedulerLock left a few SpinLockers around which were
now without locked interrupts.

* Makes scheduling_recorder work again.


# e6ea745e8114d5fa05ab0ccab92c070e2dcdcfb7 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# 03fb2d886830e4dd4b344c56725db59f96733216 07-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove gSchedulerLock

* Thread::scheduler_lock protects thread state, priority, etc.
* sThreadCreationLock protects thread creation and removal and list of
threads in team.
* Team::signal_lock and Team::time_lock protect list of threads in team
as well.
* Scheduler uses its own internal locking.


# c8dd9f7780c426e592a3ccb231e6bfab51f15eb9 29-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Add thread_unblock() and use it where possible


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 88e38c178a96634d52920e2de8bb3cbd49869f93 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replace uses of obsolescent BReference[able] API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39870 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7aba4e400ed69d328320c4fcda1617f759e98707 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved IOSchedulerRoster into its own header/source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36491 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e4087372bee8e6918048cd8f4844ac1ebb90b9f 31-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

SystemProfiler::EventOccurred(): We must not access the object after
releasing our reference to it. So return immediately after having done that.
Previously the _MaybeNotifyProfilerThread() that innocently lurked at the end
of the method would be invoked, playing with the dead beef.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35357 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8fc761bd7a76ae1259ce6b7ce35995dea52058f2 10-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Don't use a condition variable for blocking the system profiler thread, since
that causes a locking order reversal (condition variable lock <-> system
profiler lock) and thus a potential deadlock. Instead we use the thread
blocking API directly. Fixes #5229.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a38f85036021b7ccaffa47fd8584afff473acf3d 22-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* arch_debug_get_stack_trace():
- Replaced the "userOnly" parameter by a "flags" parameter, that allows to
specify kernel and userland stack traces individually.
- x86, m68k: Don't always skip the first frame as that prevents the caller
from being able to record its own address.
* capture_tracing_stack_trace(): Replaced the "userOnly" parameter by
"kernelOnly", since one is probably always interested in the kernel stack
trace, but might not want the userland stack trace.
* Added stack trace support for VM cache kernel tracing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34742 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 189010cbc29bd03a7fa6af44fbe1591774b5080a 19-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for I/O scheduling events to the system profiler interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34703 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d8d4b902cb1b24645c5a730e3a8b279201b94419 07-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# e50cf8765be50a7454c9488db38b638cf90805af 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9837ec16c86f0a533600230350e8e89203d1e9e8 20-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed spelling.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34144 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5147963dcd57fefa4f63c484eb88e9eaf4002976 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13aa1795dd62ee66e705a9c3ec5017fccb775153 20-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* It seems we always have to specify all flags to make it work; removed "flags"
parameter from start_system_profiler().
* Added stack depth, and interval parameters to it, though.
* Profiling the boot process is now possible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24a9c1bbba752056902b93c3a79997b6972030e2 20-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Added option "-r, --recorded" to profile: this will now retrieve the kernel
profile data area, and evaluate its data - it doesn't produce any output yet,
though.
* _user_system_profiler_recorded() now also makes sure the userland app can read
from the buffer area.
* Fixed leak in SharedImage::Init().
* Made the symbol retriever more smart when it deals with kernel images; if the
image ID is no longer available, it will now use the path based image symbol
iterator (and also adds the boot kernel path, in case the module don't have
one).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31653 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5fbad060b393d0ea6d13c0800c28b313de3add93 17-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Work-in-progress on a kernel profile service that can be evaluated from
userland afterwards.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31621 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 106fd6b5cbf548e487f13f0d83ac305ed77f6f7a 24-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Make the wait object hash table larger than the maximum number of wait
objects we're going to add, so we get less slot collisions.
* Use the "Unchecked" versions of the OpenHashTable Insert()/Remove() methods,
since we have interrupts disabled.
* Fixed wrong check that caused the wait object info events not to be filled in.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30384 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 227fe7d34aeed45d0727a0abde2ea2309352983b 23-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Scheduler/wait object listener:
- Moved scheduler listening interface to <listeners.h> and added more
convenient to use templatized notification functions.
- Added a listener mechanism for the wait objects (semaphores, condition
variables, mutex, rw_lock).
* system profiler:
- Hopefully fixed locking issues related to notifying the profiler thread
for good. We still had an inconsistent locking order, since the scheduler
notification callbacks are invoked with the thread lock held and have to
acquire the object lock then, while the other callbacks acquired the object
lock first and as a side effect of ConditionVariable::NotifyOne() acquired
the thread lock. Now we make sure the object lock is the innermost lock.
- Track the number of dropped events due to a full buffer.
_user_system_profiler_next_buffer() returns this count now.
- When scheduling profiling events are requested also listen to wait objects
and generate the respective profiling events. We send those events lazily
and cache the infos to avoid resending an event for the same wait object.
- When starting profiling we do now generate "thread scheduled" events for
the already running threads.
- _user_system_profiler_start(): Check whether the parameters pointer is a
userland address at all.
- The system_profiler_team_added event does now also contain the team's name.
* Added a sem_get_name_unsafe() returning a semaphore's name. It is "unsafe",
since the caller has to ensure that the semaphore exists and continues to
exist as long as the returned name is used.
* Adjusted the "profile" and "scheduling_recorder" according to the system
profiling changes. The latter prints the number of dropped events, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30345 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 146f113fec3478f6e3f0407fa615807e32bf75a8 22-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed issues with the scheduling events. In the listener callbacks we
potentially want to notify the profiler thread (i.e. wake it up), which can
cause another scheduling event notification. That is we have to make sure that
event buffer is in a consistent state at that point (i.e. wake up the thread
at the very end of the callbacks). Furthermore the ThreadEnqueuedInRunQueue()
callback can be called with spinlocks besides the thread spinlock being held. In
particular waking up threads also happens in the condition variable code with
a static spinlock being held. Trying to notify the condition variable the
profiler thread is waiting on in such a case would be a guaranteed deadlock.
Hence we avoid doing that, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30339 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bc2e00c1c7fbf7871a56f64e93c8539347c180e2 21-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_system_profiler_start(): Check the sampling related parameters only when
sampling is requested at all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30294 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1cdc2fb608a049c163ace518e8ca4b8c26c76c9b 19-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Align the entries in the event buffer to 4 bytes at least. Usually CPUs like
that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30272 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b2f0f33f9bcfadc050342f4937b0e4bf31fc6eb 18-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the interface of _kern_system_profiler_start(). The parameters are
passed in a structure now, so it is easier to extend it and ignore unused
parameters.
* One can now select which system profiling events one is interested in.
* Added scheduling events to the system profiling interface. Those are pretty
much the ones recorded when scheduler tracing is enabled. Still missing are
the "wait object" events that allow to interpret what a thread is waiting
for.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30243 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1b9d2885d30d9fb9bdd083550d9da97c0e80af6c 16-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Also pass the team arguments and thread names with the respective system
profiling events.
* profile: Avoid using get_{team,thread}_info() in common code paths. The
system profiling mode is asynchronous, so the team or thread in question
could already be gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30193 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e2ae69da521f652fa907f3119179ea5674f6a1a0 11-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

The kernel side of a new system-wide sampling-based profiling mechanism.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30127 a95241bf-73f2-0310-859d-f6bbb57e9c96