xtd 0.2.0
xtd::diagnostics::trace_event_cache Class Reference

Definition

Provides trace event data specific to a thread and a process.

class core_export_ trace_event_cache : public xtd::object
Inheritance
xtd::objectxtd::diagnostics::trace_event_cache
Header
#include <xtd/diagnostics/trace_event_cache>
Namespace
xtd::diagnostics
Library
xtd.core

Constructors

 trace_event_cache ()=default
 Initializes a new instance of the trace_event_cache class. More...
 

Properties

xtd::ustring call_stack () const noexcept
 Gets the call stack for the current thread. More...
 
const xtd::date_timedate_time () const noexcept
 Gets the date and time at which the event trace occurred. More...
 
std::vector< xtd::ustringlogical_operation_stack () const noexcept
 Gets the correlation data, contained in a stack. More...
 
int32 process_id () const noexcept
 Gets the unique identifier of the current process. More...
 
xtd::ustring thread_id () const noexcept
 Gets a unique identifier for the current managed thread. More...
 
std::chrono::nanoseconds timestamp () const noexcept
 Gets the current number of ticks in the timer mechanism. More...
 
int64 timestamp_milliseconds () const noexcept
 Gets the current number of ticks in the timer mechanism, in milliseconds. More...
 
int64 timestamp_nanoseconds () const noexcept
 Gets the current number of ticks in the timer mechanism, in nanoseconds. More...
 
int64 timestamp_ticks () const noexcept
 Gets the current number of ticks in the timer mechanism, in nanoseconds. More...
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a sxd::ustring that represents the current object. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ trace_event_cache()

xtd::diagnostics::trace_event_cache::trace_event_cache ( )
default

Initializes a new instance of the trace_event_cache class.

Member Function Documentation

◆ call_stack()

xtd::ustring xtd::diagnostics::trace_event_cache::call_stack ( ) const
noexcept

Gets the call stack for the current thread.

Returns
string A string containing stack trace information. This value can be an empty string ("").
Remarks
The Callstack property gets the call stack from the StackTrace property of the Environment class. The property value lists method calls in reverse chronological order. That is, the most recent method call is described first. One line of stack trace information is listed for each method call on the stack. For more information, see StackTrace.

◆ date_time()

const xtd::date_time& xtd::diagnostics::trace_event_cache::date_time ( ) const
noexcept

Gets the date and time at which the event trace occurred.

Returns
DateTime A DateTime structure whose value is a date and time expressed in Coordinated Universal Time (UTC).
Remarks
The first time the property is accessed in an instance of the trace_event_cache class, the current time is returned. Subsequent queries of this property in that instance return that same DateTime value, allowing it to be used as a timestamp.

◆ logical_operation_stack()

std::vector<xtd::ustring> xtd::diagnostics::trace_event_cache::logical_operation_stack ( ) const
noexcept

Gets the correlation data, contained in a stack.

Returns
A Stack containing correlation data.
Remarks
The correlation data is stored as an object in the call context with the name "System.Diagnostics.Trace.CorrelationManagerSlot". The CorrelationManager class provides methods used to store a logical operation identity in a thread-bound context and automatically tag each trace event generated by the thread with the stored identity. The CorrelationManager is accessed through the Trace.CorrelationManager property. Each call to the StartLogicalOperation method pushes a new logical operation identity onto the stack. Each call to the StopLogicalOperation method pops a logical operation identity from the stack

◆ process_id()

int32 xtd::diagnostics::trace_event_cache::process_id ( ) const
noexcept

Gets the unique identifier of the current process.

Returns
int32 The system-generated unique identifier of the current process.
Remarks
Until the process terminates, the process identifier uniquely identifies the process throughout the system.

◆ thread_id()

xtd::ustring xtd::diagnostics::trace_event_cache::thread_id ( ) const
noexcept

Gets a unique identifier for the current managed thread.

Returns
string A string that represents a unique integer identifier for this managed thread.
Remarks
The thread identifier is the value of the Thread.ManagedThreadId property formatted as a string.

◆ timestamp()

std::chrono::nanoseconds xtd::diagnostics::trace_event_cache::timestamp ( ) const
noexcept

Gets the current number of ticks in the timer mechanism.

Returns
std::chrono::nanoseconds The nanoseconds counter value of the underlying timer mechanism.
Remarks
The get accessor calls the Stopwatch.GetTimestamp method to get the timestamp. If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the Ticks property of DateTime.Now.

◆ timestamp_milliseconds()

int64 xtd::diagnostics::trace_event_cache::timestamp_milliseconds ( ) const
noexcept

Gets the current number of ticks in the timer mechanism, in milliseconds.

Returns
int64 The millisecond counter value of the underlying timer mechanism.
Remarks
The get accessor calls the Stopwatch.GetTimestamp method to get the timestamp. If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the Ticks property of DateTime.Now.

◆ timestamp_nanoseconds()

int64 xtd::diagnostics::trace_event_cache::timestamp_nanoseconds ( ) const
noexcept

Gets the current number of ticks in the timer mechanism, in nanoseconds.

Returns
int64 The nanosecond counter value of the underlying timer mechanism.
Remarks
The get accessor calls the Stopwatch.GetTimestamp method to get the timestamp. If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the Ticks property of DateTime.Now.

◆ timestamp_ticks()

int64 xtd::diagnostics::trace_event_cache::timestamp_ticks ( ) const
noexcept

Gets the current number of ticks in the timer mechanism, in nanoseconds.

Returns
int64 The tick counter value of the underlying timer mechanism.
Remarks
The get accessor calls the Stopwatch.GetTimestamp method to get the timestamp. If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the Ticks property of DateTime.Now.

The documentation for this class was generated from the following file: