xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Types | Public Member Functions | List of all members
xtd::diagnostics::trace_event_cache Class Reference

#include <trace_event_cache.h>

Definition

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

Namespace
xtd::diagnostics
Library
xtd.core

Public Types

using clock = std::chrono::system_clock
 

Public Member Functions

 trace_event_cache ()=default
 Initializes a new instance of the trace_event_cache class. More...
 
xtd::ustring call_stack () const
 Gets the call stack for the current thread. More...
 
clock::time_point date_time () const
 Gets the date and time at which the event trace occurred. More...
 
std::vector< xtd::ustringlogical_operation_stack () const
 Gets the correlation data, contained in a stack. More...
 
int32_t process_id () const
 Gets the unique identifier of the current process. More...
 
xtd::ustring thread_id () const
 Gets a unique identifier for the current managed thread. More...
 
int64_t timestamp () const
 Gets the current number of ticks in the timer mechanism. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual 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...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object. More...
 

Additional Inherited Members

- 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

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.
Todo:
Uncomment when stack_trace will implemented

◆ date_time()

clock::time_point xtd::diagnostics::trace_event_cache::date_time ( ) const

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

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_t xtd::diagnostics::trace_event_cache::process_id ( ) const

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

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()

int64_t xtd::diagnostics::trace_event_cache::timestamp ( ) const

Gets the current number of ticks in the timer mechanism.

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: