2 * Copyright 2011, Michael Lotz <mmlr@mlotz.ch>.
3 * Copyright 2011, Ingo Weinhold <ingo_weinhold@gmx.de>.
5 * Distributed under the terms of the MIT License.
7 #ifndef ALLOCATION_TRACKING_H
8 #define ALLOCATION_TRACKING_H
17 class AllocationTrackingInfo
{
19 AbstractTraceEntryWithStackTrace
* traceEntry
;
20 bigtime_t traceEntryTimestamp
;
23 void Init(AbstractTraceEntryWithStackTrace
* entry
)
26 traceEntryTimestamp
= entry
!= NULL
? entry
->Time() : -1;
27 // Note: this is a race condition, if the tracing buffer wrapped and
28 // got overwritten once, we would access an invalid trace entry
29 // here. Obviously this is rather unlikely.
35 traceEntryTimestamp
= 0;
38 bool IsInitialized() const
40 return traceEntryTimestamp
!= 0;
43 AbstractTraceEntryWithStackTrace
* TraceEntry() const
48 bool IsTraceEntryValid() const
50 return tracing_is_entry_valid(traceEntry
, traceEntryTimestamp
);
54 } // namespace BKernel
57 using BKernel::AllocationTrackingInfo
;
60 #endif // ALLOCATION_TRACKING_H