|
The Pedigree Project 0.1
|
#include <LocksCommand.h>
Inheritance diagram for LocksCommand:
Collaboration diagram for LocksCommand:Classes | |
| struct | LockDescriptor |
Public Member Functions | |
| LocksCommand () | |
| virtual | ~LocksCommand () |
| void | autocomplete (const HugeStaticString &input, HugeStaticString &output) |
| bool | execute (const HugeStaticString &input, HugeStaticString &output, InterruptState &state, DebuggerIO *screen) |
| const NormalStaticString | getString () |
| void | setReady () |
| void | setFatal () |
| bool | lockAttempted (const Spinlock *pLock, size_t nCpu=~0U, bool intState=false) |
| bool | lockAcquired (const Spinlock *pLock, size_t nCpu=~0U, bool intState=false) |
| bool | lockReleased (const Spinlock *pLock, size_t nCpu=~0U) |
| bool | checkSchedule (size_t nCpu=~0U) |
| bool | checkState (const Spinlock *pLock, size_t nCpu=~0U) |
| virtual const char * | getLine1 (size_t index, DebuggerIO::Colour &colour, DebuggerIO::Colour &bgColour) |
| virtual const char * | getLine2 (size_t index, size_t &colOffset, DebuggerIO::Colour &colour, DebuggerIO::Colour &bgColour) |
| virtual size_t | getLineCount () |
Public Member Functions inherited from Scrollable | |
| void | move (size_t x, size_t y) |
| void | resize (size_t width, size_t height) |
| void | scroll (ssize_t lines) |
| void | scrollTo (size_t absolute) |
| void | scrollHorizontal (ssize_t columns) |
| void | horizontalScrollTo (size_t absolute) |
| void | refresh (DebuggerIO *pScreen) |
| void | setScrollKeys (char up, char down) |
| ssize_t | getLine () |
| void | centreOn (size_t line) |
| size_t | height () const |
| size_t | width () const |
| virtual size_t | getContentWidth () |
Protected Member Functions | |
| void | clearFatal () |
Private Types | |
| enum | State { Inactive = 0 , Attempted , Acquired , Checked } |
Private Member Functions | |
| const char * | stateName (State s) |
Private Attributes | |
| LockDescriptor | m_pDescriptors [LOCKS_COMMAND_NUM_CPU][MAX_DESCRIPTORS] |
| Atomic< bool > | m_bAcquiring |
| Atomic< uint8_t > | m_NextPosition [LOCKS_COMMAND_NUM_CPU] |
| Atomic< size_t > | m_LockIndex |
| bool | m_bFatal |
| size_t | m_SelectedLine |
| LockDescriptor * | m_pSelectedLock |
| Lock we've selected for backtracing. | |
Friends | |
| class | Spinlock |
Additional Inherited Members | |
Protected Attributes inherited from Scrollable | |
| size_t | m_x |
| size_t | m_y |
| size_t | m_width |
| size_t | m_height |
| ssize_t | m_line |
| size_t | m_column |
| char | m_ScrollUp |
| char | m_ScrollDown |
Traces lock allocations.
Definition at line 53 of file LocksCommand.h.
|
private |
| Enumerator | |
|---|---|
| Inactive | This entry is no longer active. |
| Attempted | The lock is about to be attempted. |
| Acquired | The lock is acquired. |
| Checked | The lock failed to be acquired, and has been checked once. |
Definition at line 123 of file LocksCommand.h.
| LocksCommand::LocksCommand | ( | ) |
Default constructor - zeroes stuff.
Definition at line 44 of file LocksCommand.cc.
References m_NextPosition.
|
virtual |
Default destructor - does nothing.
Definition at line 56 of file LocksCommand.cc.
|
virtual |
Return an autocomplete string, given an input string.
Implements DebuggerCommand.
Definition at line 58 of file LocksCommand.cc.
| bool LocksCommand::checkSchedule | ( | size_t | nCpu = ~0U | ) |
Notifies the command that a core is about to reschedule.
Note: NO locks should be held across a reschedule.
Definition at line 430 of file LocksCommand.cc.
References Hex, ProcessorBase::index(), and m_NextPosition.
Referenced by PerProcessorScheduler::addThread(), and PerProcessorScheduler::addThread().
Here is the caller graph for this function:| bool LocksCommand::checkState | ( | const Spinlock * | pLock, |
| size_t | nCpu = ~0U |
||
| ) |
Notifies the command that we'd like to lock the given lock, allowing the LocksCommand instance to detect common concurrency issues like dependency inversion. This should be called after an acquire() fails, as it may have undesirable overhead for the "perfect" case.
Definition at line 452 of file LocksCommand.cc.
References Acquired, Attempted, Hex, Inactive, ProcessorBase::index(), m_NextPosition, and ProcessorBase::pause().
Referenced by Spinlock::acquireContended().
Here is the caller graph for this function:
|
protected |
Definition at line 307 of file LocksCommand.cc.
|
virtual |
Execute the command with the given screen.
Implements DebuggerCommand.
Definition at line 60 of file LocksCommand.cc.
References DebuggerIO::drawHorizontalLine(), DebuggerIO::drawString(), DebuggerIO::enableCli(), DebuggerIO::getChar(), and DebuggerIO::getWidth().
|
virtual |
Implements Scrollable.
Definition at line 147 of file LocksCommand.cc.
|
virtual |
Implements Scrollable.
Definition at line 207 of file LocksCommand.cc.
|
virtual |
Implements Scrollable.
Definition at line 284 of file LocksCommand.cc.
|
inlinevirtual |
Returns the string representation of this command.
Implements DebuggerCommand.
Definition at line 81 of file LocksCommand.h.
| bool LocksCommand::lockAcquired | ( | const Spinlock * | pLock, |
| size_t | nCpu = ~0U, |
||
| bool | intState = false |
||
| ) |
Definition at line 349 of file LocksCommand.cc.
| bool LocksCommand::lockAttempted | ( | const Spinlock * | pLock, |
| size_t | nCpu = ~0U, |
||
| bool | intState = false |
||
| ) |
Definition at line 311 of file LocksCommand.cc.
| bool LocksCommand::lockReleased | ( | const Spinlock * | pLock, |
| size_t | nCpu = ~0U |
||
| ) |
Definition at line 382 of file LocksCommand.cc.
References Acquired, Hex, Inactive, ProcessorBase::index(), and m_NextPosition.
Referenced by PerProcessorScheduler::addThread(), PerProcessorScheduler::addThread(), and Spinlock::trackRelease().
Here is the caller graph for this function:| void LocksCommand::setFatal | ( | ) |
LocksCommand defaults to logging errors and returning failure. Call this to change it to logging fatal errors itself.
Definition at line 303 of file LocksCommand.cc.
Referenced by Spinlock::acquire(), Spinlock::acquireContended(), and Spinlock::trackRelease().
Here is the caller graph for this function:| void LocksCommand::setReady | ( | ) |
Definition at line 299 of file LocksCommand.cc.
|
inlineprivate |
Definition at line 134 of file LocksCommand.h.
|
friend |
Definition at line 54 of file LocksCommand.h.
|
private |
Definition at line 158 of file LocksCommand.h.
|
private |
Definition at line 163 of file LocksCommand.h.
|
private |
Definition at line 161 of file LocksCommand.h.
|
private |
Definition at line 160 of file LocksCommand.h.
Referenced by checkSchedule(), checkState(), lockReleased(), and LocksCommand().
|
private |
Definition at line 156 of file LocksCommand.h.
|
private |
Lock we've selected for backtracing.
Definition at line 168 of file LocksCommand.h.
|
private |
Definition at line 165 of file LocksCommand.h.