HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
UT_UniversalLogInMemorySink.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: UT_UniversalLogInMemorySink.h ( FS Library, C++)
7
*
8
* COMMENTS:
9
*
10
*/
11
12
#ifndef __UT_UniversalLogInMemorySink__
13
#define __UT_UniversalLogInMemorySink__
14
15
#include "
UT_API.h
"
16
#include "
UT_Lock.h
"
17
#include "
UT_SharedPtr.h
"
18
#include "
UT_UniversalLogEntry.h
"
19
#include "
UT_UniversalLogSink.h
"
20
#include "
UT_UniversalLogFileSink.h
"
21
#include <
SYS/SYS_Types.h
>
22
#include <
SYS/SYS_AtomicInt.h
>
23
24
class
UT_StringRef
;
25
26
/// This class is a universal log sync which stores all log entries in memory.
27
/// A maximum memory use threshold can be set, and excess messages are
28
/// automatically deleted.
29
class
UT_API
UT_UniversalLogInMemorySink
:
public
UT_UniversalLogSink
30
{
31
public
:
32
UT_UniversalLogInMemorySink
();
33
~
UT_UniversalLogInMemorySink
()
override
;
34
35
/// Returns the number of log entries currently in memory. An entry may
36
/// become "inactive" (i.e. flushed from memory) when this sink reaches
37
/// its maximum log count, or if someone steals our log entries.
38
exint
activeLogCount();
39
/// Returns the number of log entries we have ever seen. It can be useful
40
/// to have this monotonically increasing number to look for changes and
41
/// insulate from the automated (or manual) purging of log entries.
42
exint
allTimeLogCount();
43
/// Returns a copy of the log entry at a specific all-time index. If the
44
/// index is out of range, or is no longer active, an empty log entry is
45
/// returned.
46
UT_UniversalLogEntry
allTimeLogEntry(
exint
all_time_idx);
47
/// Steals all current log entries into the supplied array. This object
48
/// will no longer have any record of these log entries after this call.
49
void
stealLogEntries(
UT_UniversalLogEntryArray
&
log
);
50
51
protected
:
52
/// This override stores the log messages in memory.
53
void
doLog
(
const
UT_UniversalLogEntry
&entry)
override
;
54
55
/// Grab messages from the inbound log entries and add them to the
56
/// inspectable log entries. This function also enforces the maximum
57
/// total message size.
58
///
59
/// NOTE: myDataLock MUST be locked before calling this method.
60
void
adoptInboundLogEntries();
61
62
/// The inbound message queue is where events get logged, but messages
63
/// on this queue cannot be inspected. We never want the addition of
64
/// new messages to be blocked by some (potentially slow) inspection of
65
/// the current set of messages.
66
UT_Lock
myInboundDataLock
;
67
UT_UniversalLogEntryArray
myInboundLogEntries
;
68
SYS_AtomicCounter
myInboundTotalLogEntriesSize
;
69
/// These log entries are the ones that have been collected from the
70
/// inbound queue. And filtering and sorting happens during this
71
/// transition.
72
UT_Lock
myDataLock
;
73
UT_UniversalLogEntryArray
myLogEntries
;
74
exint
myTotalLogEntriesSize
;
75
exint
myMaxTotalLogEntriesSize
;
76
/// A counter that is increased any time a message is added.
77
SYS_AtomicCounter
myAllTimeLogCount
;
78
};
79
80
#endif
81
UT_SharedPtr.h
exint
int64 exint
Definition:
SYS_Types.h:125
UT_API.h
UT_UniversalLogFileSink.h
UT_API
#define UT_API
Definition:
UT_API.h:14
UT_StringRef
Definition:
UT_StringHolder.h:188
UT_UniversalLogInMemorySink::myLogEntries
UT_UniversalLogEntryArray myLogEntries
Definition:
UT_UniversalLogInMemorySink.h:73
UT_UniversalLogEntry.h
UT_UniversalLogInMemorySink::myAllTimeLogCount
SYS_AtomicCounter myAllTimeLogCount
A counter that is increased any time a message is added.
Definition:
UT_UniversalLogInMemorySink.h:77
UT_UniversalLogInMemorySink::myMaxTotalLogEntriesSize
exint myMaxTotalLogEntriesSize
Definition:
UT_UniversalLogInMemorySink.h:75
UT_Array< UT_UniversalLogEntry >
UT_UniversalLogSink.h
UT_SpinLockT< true, false >
UT_UniversalLogSink
Definition:
UT_UniversalLogSink.h:30
SYS_AtomicInt.h
UT_UniversalLogInMemorySink::myInboundTotalLogEntriesSize
SYS_AtomicCounter myInboundTotalLogEntriesSize
Definition:
UT_UniversalLogInMemorySink.h:68
SYS_Types.h
UT_UniversalLogInMemorySink::myDataLock
UT_Lock myDataLock
Definition:
UT_UniversalLogInMemorySink.h:72
UT_UniversalLogInMemorySink::myInboundDataLock
UT_Lock myInboundDataLock
Definition:
UT_UniversalLogInMemorySink.h:66
UT_UniversalLogInMemorySink
Definition:
UT_UniversalLogInMemorySink.h:29
UT_UniversalLogSink::doLog
virtual void doLog(const UT_UniversalLogEntry &entry)=0
UT_UniversalLogInMemorySink::myInboundLogEntries
UT_UniversalLogEntryArray myInboundLogEntries
Definition:
UT_UniversalLogInMemorySink.h:67
SYS_AtomicInt< int32 >
simd::log
OIIO_FORCEINLINE T log(const T &v)
Definition:
simd.h:7688
UT_Lock.h
UT_UniversalLogEntry
Simple object to hold the data associated with a single log entry event.
Definition:
UT_UniversalLogEntry.h:58
UT_UniversalLogInMemorySink::myTotalLogEntriesSize
exint myTotalLogEntriesSize
Definition:
UT_UniversalLogInMemorySink.h:74
UT
UT_UniversalLogInMemorySink.h
Generated on Thu Nov 21 2024 02:46:17 for HDK by
1.8.6