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 <
SYS/SYS_Types.h
>
21
#include <
SYS/SYS_AtomicInt.h
>
22
23
class
UT_StringRef
;
24
25
/// This class is a universal log sync which stores all log entries in memory.
26
/// A maximum memory use threshold can be set, and excess messages are
27
/// automatically deleted.
28
class
UT_API
UT_UniversalLogInMemorySink
:
public
UT_UniversalLogSink
29
{
30
public
:
31
UT_UniversalLogInMemorySink
();
32
~
UT_UniversalLogInMemorySink
()
override
;
33
34
/// Returns the number of log entries currently in memory. An entry may
35
/// become "inactive" (i.e. flushed from memory) when this sink reaches
36
/// its maximum log count, or if someone steals our log entries.
37
exint
activeLogCount();
38
/// Returns the number of log entries we have ever seen. It can be useful
39
/// to have this monotonically increasing number to look for changes and
40
/// insulate from the automated (or manual) purging of log entries.
41
exint
allTimeLogCount();
42
/// Returns a copy of the active log entry at a specific index. If the
43
/// index is out of range, an empty log entry is returned.
44
UT_UniversalLogEntry
activeLogEntry(
exint
active_idx);
45
/// Returns a copy of the log entry at a specific all-time index. If the
46
/// index is out of range, or is no longer active, an empty log entry is
47
/// returned.
48
UT_UniversalLogEntry
allTimeLogEntry(
exint
all_time_idx);
49
/// Steals all current log entries into the supplied array. This object
50
/// will no longer have any record of these log entries after this call.
51
void
stealLogEntries(
UT_UniversalLogEntryArray
&
log
);
52
53
protected
:
54
/// This override stores the log messages in memory.
55
void
doLog
(
const
UT_UniversalLogEntry
&entry)
override
;
56
57
/// Grab messages from the inbound log entries and add them to the
58
/// inspectable log entries. This function also enforces the maximum
59
/// total message size.
60
///
61
/// NOTE: myDataLock MUST be locked before calling this method.
62
void
adoptInboundLogEntries();
63
64
/// The inbound message queue is where events get logged, but messages
65
/// on this queue cannot be inspected. We never want the addition of
66
/// new messages to be blocked by some (potentially slow) inspection of
67
/// the current set of messages.
68
UT_Lock
myInboundDataLock
;
69
UT_UniversalLogEntryArray
myInboundLogEntries
;
70
SYS_AtomicCounter
myInboundTotalLogEntriesSize
;
71
/// These log entries are the ones that have been collected from the
72
/// inbound queue. And filtering and sorting happens during this
73
/// transition.
74
UT_Lock
myDataLock
;
75
UT_UniversalLogEntryArray
myLogEntries
;
76
exint
myTotalLogEntriesSize
;
77
exint
myMaxTotalLogEntriesSize
;
78
/// A counter that is increased any time a message is added.
79
SYS_AtomicCounter
myAllTimeLogCount
;
80
};
81
82
UT_API
bool
83
UThasAnyDefaultLogSources
();
84
UT_API
bool
85
UTisDefaultLogSource
(
const
UT_StringRef
&source_name);
86
UT_API
const
UT_SharedPtr<UT_UniversalLogInMemorySink>
&
87
UTgetDefaultLogInMemorySink
(
bool
create_from_env,
bool
force_create);
88
89
#endif
90
UTisDefaultLogSource
UT_API bool UTisDefaultLogSource(const UT_StringRef &source_name)
UT_SharedPtr.h
UTgetDefaultLogInMemorySink
UT_API const UT_SharedPtr< UT_UniversalLogInMemorySink > & UTgetDefaultLogInMemorySink(bool create_from_env, bool force_create)
UThasAnyDefaultLogSources
UT_API bool UThasAnyDefaultLogSources()
exint
int64 exint
Definition:
SYS_Types.h:125
UT_API.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:75
UT_UniversalLogEntry.h
UT_UniversalLogInMemorySink::myAllTimeLogCount
SYS_AtomicCounter myAllTimeLogCount
A counter that is increased any time a message is added.
Definition:
UT_UniversalLogInMemorySink.h:79
UT_UniversalLogInMemorySink::myMaxTotalLogEntriesSize
exint myMaxTotalLogEntriesSize
Definition:
UT_UniversalLogInMemorySink.h:77
UT_Array< UT_UniversalLogEntry >
UT_UniversalLogSink.h
UT_SpinLockT< true, false >
UT_UniversalLogSink
Definition:
UT_UniversalLogSink.h:27
SYS_AtomicInt.h
UT_UniversalLogInMemorySink::myInboundTotalLogEntriesSize
SYS_AtomicCounter myInboundTotalLogEntriesSize
Definition:
UT_UniversalLogInMemorySink.h:70
SYS_Types.h
UT_SharedPtr
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition:
UT_SharedPtr.h:36
UT_UniversalLogInMemorySink::myDataLock
UT_Lock myDataLock
Definition:
UT_UniversalLogInMemorySink.h:74
UT_UniversalLogInMemorySink::myInboundDataLock
UT_Lock myInboundDataLock
Definition:
UT_UniversalLogInMemorySink.h:68
UT_UniversalLogInMemorySink
Definition:
UT_UniversalLogInMemorySink.h:28
UT_UniversalLogSink::doLog
virtual void doLog(const UT_UniversalLogEntry &entry)=0
UT_UniversalLogInMemorySink::myInboundLogEntries
UT_UniversalLogEntryArray myInboundLogEntries
Definition:
UT_UniversalLogInMemorySink.h:69
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:76
UT
UT_UniversalLogInMemorySink.h
Generated on Thu Mar 28 2024 03:47:51 for HDK by
1.8.6