summaryrefslogtreecommitdiff
path: root/src/vm/eventpipeevent.h
blob: 1ae02900e1133dd242a57be59d247695ece84443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#ifndef __EVENTPIPE_EVENT_H__
#define __EVENTPIPE_EVENT_H__

#ifdef FEATURE_PERFTRACING

#include "eventpipeprovider.h"

class EventPipeEvent
{
    // Declare friends.
    friend class EventPipeProvider;

private:

    // The provider that contains the event.
    EventPipeProvider *m_pProvider;

    // Bit vector containing the keywords that enable the event.
    INT64 m_keywords;

    // The ID (within the provider) of the event.
    unsigned int m_eventID;

    // The version of the event.
    unsigned int m_eventVersion;

    // The verbosity of the event.
    EventPipeEventLevel m_level;

    // True if a call stack should be captured when writing the event.
    bool m_needStack;

    // True if the event is current enabled.
    Volatile<bool> m_enabled;

    // Metadata
    BYTE *m_pMetadata;

    // Metadata length;
    unsigned int m_metadataLength;

    // Refreshes the runtime state for this event.
    // Called by EventPipeProvider when the provider configuration changes.
    void RefreshState();

    // Only EventPipeProvider can create events.
    // The provider is responsible for allocating and freeing events.
    EventPipeEvent(EventPipeProvider &provider, INT64 keywords, unsigned int eventID, unsigned int eventVersion, EventPipeEventLevel level, bool needStack, BYTE *pMetadata = NULL, unsigned int metadataLength = 0);

  public:
    ~EventPipeEvent();

    // Get the provider associated with this event.
    EventPipeProvider* GetProvider() const;

    // Get the keywords that enable the event.
    INT64 GetKeywords() const;

    // Get the ID (within the provider) of the event.
    unsigned int GetEventID() const;

    // Get the version of the event.
    unsigned int GetEventVersion() const;

    // Get the verbosity of the event.
    EventPipeEventLevel GetLevel() const;

    // True if a call stack should be captured when writing the event.
    bool NeedStack() const;

    // True if the event is currently enabled.
    bool IsEnabled() const;

    BYTE *GetMetadata() const;

    unsigned int GetMetadataLength() const;

  private:
    // used when Metadata is not provided
    BYTE *BuildMinimumMetadata();

    unsigned int GetMinimumMetadataLength();
};

#endif // FEATURE_PERFTRACING

#endif // __EVENTPIPE_EVENT_H__