* Made TraceEntryIterator available in the kernel.
* Fixed TraceEntryIterator::Current(): If fEntry was NULL, it would return 0x4. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26955 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -63,6 +63,7 @@ class TraceOutput {
|
|||||||
bigtime_t fLastEntryTime;
|
bigtime_t fLastEntryTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TraceEntry {
|
class TraceEntry {
|
||||||
public:
|
public:
|
||||||
TraceEntry();
|
TraceEntry();
|
||||||
@@ -89,6 +90,7 @@ class TraceEntry {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AbstractTraceEntry : public TraceEntry {
|
class AbstractTraceEntry : public TraceEntry {
|
||||||
public:
|
public:
|
||||||
AbstractTraceEntry();
|
AbstractTraceEntry();
|
||||||
@@ -108,6 +110,7 @@ class AbstractTraceEntry : public TraceEntry {
|
|||||||
bigtime_t fTime;
|
bigtime_t fTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LazyTraceOutput : public TraceOutput {
|
class LazyTraceOutput : public TraceOutput {
|
||||||
public:
|
public:
|
||||||
LazyTraceOutput(char* buffer, size_t bufferSize, uint32 flags)
|
LazyTraceOutput(char* buffer, size_t bufferSize, uint32 flags)
|
||||||
@@ -126,6 +129,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TraceFilter {
|
class TraceFilter {
|
||||||
public:
|
public:
|
||||||
virtual ~TraceFilter();
|
virtual ~TraceFilter();
|
||||||
@@ -145,11 +149,52 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WrapperTraceFilter : public TraceFilter {
|
class WrapperTraceFilter : public TraceFilter {
|
||||||
public:
|
public:
|
||||||
virtual void Init(TraceFilter* filter, int direction, bool continued) = 0;
|
virtual void Init(TraceFilter* filter, int direction, bool continued) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TraceEntryIterator {
|
||||||
|
public:
|
||||||
|
TraceEntryIterator()
|
||||||
|
:
|
||||||
|
fEntry(NULL),
|
||||||
|
fIndex(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
fEntry = NULL;
|
||||||
|
fIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 Index() const
|
||||||
|
{
|
||||||
|
return fIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
TraceEntry* Current() const
|
||||||
|
{
|
||||||
|
return fEntry != NULL ? TraceEntry::FromTraceEntry(fEntry) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TraceEntry* Next();
|
||||||
|
TraceEntry* Previous();
|
||||||
|
TraceEntry* MoveTo(int32 index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
trace_entry* _NextNonBufferEntry(trace_entry* entry);
|
||||||
|
trace_entry* _PreviousNonBufferEntry(trace_entry* entry);
|
||||||
|
|
||||||
|
private:
|
||||||
|
trace_entry* fEntry;
|
||||||
|
int32 fIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -697,33 +697,9 @@ TraceFilterParser TraceFilterParser::sParser;
|
|||||||
#if ENABLE_TRACING
|
#if ENABLE_TRACING
|
||||||
|
|
||||||
|
|
||||||
class TraceEntryIterator {
|
TraceEntry*
|
||||||
public:
|
TraceEntryIterator::Next()
|
||||||
TraceEntryIterator()
|
{
|
||||||
:
|
|
||||||
fEntry(NULL),
|
|
||||||
fIndex(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset()
|
|
||||||
{
|
|
||||||
fEntry = NULL;
|
|
||||||
fIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 Index() const
|
|
||||||
{
|
|
||||||
return fIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceEntry* Current() const
|
|
||||||
{
|
|
||||||
return TraceEntry::FromTraceEntry(fEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceEntry* Next()
|
|
||||||
{
|
|
||||||
if (fIndex == 0) {
|
if (fIndex == 0) {
|
||||||
fEntry = _NextNonBufferEntry(sFirstEntry);
|
fEntry = _NextNonBufferEntry(sFirstEntry);
|
||||||
fIndex = 1;
|
fIndex = 1;
|
||||||
@@ -733,10 +709,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Current();
|
return Current();
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceEntry* Previous()
|
|
||||||
{
|
TraceEntry*
|
||||||
|
TraceEntryIterator::Previous()
|
||||||
|
{
|
||||||
if (fIndex == (int32)sEntries + 1)
|
if (fIndex == (int32)sEntries + 1)
|
||||||
fEntry = sAfterLastEntry;
|
fEntry = sAfterLastEntry;
|
||||||
|
|
||||||
@@ -746,10 +724,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Current();
|
return Current();
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceEntry* MoveTo(int32 index)
|
|
||||||
{
|
TraceEntry*
|
||||||
|
TraceEntryIterator::MoveTo(int32 index)
|
||||||
|
{
|
||||||
if (index == fIndex)
|
if (index == fIndex)
|
||||||
return Current();
|
return Current();
|
||||||
|
|
||||||
@@ -787,29 +767,27 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Current();
|
return Current();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
trace_entry* _NextNonBufferEntry(trace_entry* entry)
|
trace_entry*
|
||||||
{
|
TraceEntryIterator::_NextNonBufferEntry(trace_entry* entry)
|
||||||
|
{
|
||||||
while (entry != NULL && (entry->flags & BUFFER_ENTRY) != 0)
|
while (entry != NULL && (entry->flags & BUFFER_ENTRY) != 0)
|
||||||
entry = next_entry(entry);
|
entry = next_entry(entry);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_entry* _PreviousNonBufferEntry(trace_entry* entry)
|
|
||||||
{
|
trace_entry*
|
||||||
|
TraceEntryIterator::_PreviousNonBufferEntry(trace_entry* entry)
|
||||||
|
{
|
||||||
while (entry != NULL && (entry->flags & BUFFER_ENTRY) != 0)
|
while (entry != NULL && (entry->flags & BUFFER_ENTRY) != 0)
|
||||||
entry = previous_entry(entry);
|
entry = previous_entry(entry);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
trace_entry* fEntry;
|
|
||||||
int32 fIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Reference in New Issue
Block a user