1
2// Licensed to the .NET Foundation under one or more agreements.
3// The .NET Foundation licenses this file to you under the MIT license.
4// See the LICENSE file in the project root for more information.
5
6/******************************************************************
7
8DO NOT MODIFY. AUTOGENERATED FILE.
9This file is generated using the logic from <root>/src/scripts/genLttngProvider.py
10
11******************************************************************/
12
13
14#define TRACEPOINT_DEFINE
15#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
16
17#include "stdlib.h"
18#include "pal_mstypes.h"
19#include "pal_error.h"
20#include "pal.h"
21#define PAL_free free
22#define PAL_realloc realloc
23#include "pal/stackstring.hpp"
24#include "tpdotnetruntimestress.h"
25
26#ifndef tracepoint_enabled
27#define tracepoint_enabled(provider, name) TRUE
28#define do_tracepoint tracepoint
29#endif
30
31#define wcslen PAL_wcslen
32
33bool ResizeBuffer(char *&buffer, size_t& size, size_t currLen, size_t newSize, bool &fixedBuffer);
34bool WriteToBuffer(PCWSTR str, char *&buffer, size_t& offset, size_t& size, bool &fixedBuffer);
35bool WriteToBuffer(const char *str, char *&buffer, size_t& offset, size_t& size, bool &fixedBuffer);
36bool WriteToBuffer(const BYTE *src, size_t len, char *&buffer, size_t& offset, size_t& size, bool &fixedBuffer);
37
38template <typename T>
39bool WriteToBuffer(const T &value, char *&buffer, size_t& offset, size_t& size, bool &fixedBuffer)
40{
41 if (sizeof(T) + offset > size)
42 {
43 if (!ResizeBuffer(buffer, size, offset, size + sizeof(T), fixedBuffer))
44 return false;
45 }
46
47 memcpy(buffer + offset, (char *)&value, sizeof(T));
48 offset += sizeof(T);
49 return true;
50}
51
52extern "C" BOOL EventXplatEnabledStressLogEvent(){ return tracepoint_enabled(DotNETRuntimeStress, StressLogEvent); }
53
54extern "C" ULONG FireEtXplatStressLogEvent(
55 const unsigned int Facility,
56 const unsigned char LogLevel,
57 LPCSTR Message)
58{
59 if (!EventXplatEnabledStressLogEvent())
60 return ERROR_SUCCESS;
61
62 do_tracepoint(DotNETRuntimeStress,
63 StressLogEvent,
64 Facility,
65 LogLevel,
66 Message);
67
68 return ERROR_SUCCESS;
69}
70
71extern "C" BOOL EventXplatEnabledStressLogEvent_V1(){ return tracepoint_enabled(DotNETRuntimeStress, StressLogEvent_V1); }
72
73extern "C" ULONG FireEtXplatStressLogEvent_V1(
74 const unsigned int Facility,
75 const unsigned char LogLevel,
76 LPCSTR Message,
77 const unsigned short ClrInstanceID)
78{
79 if (!EventXplatEnabledStressLogEvent_V1())
80 return ERROR_SUCCESS;
81
82 do_tracepoint(DotNETRuntimeStress,
83 StressLogEvent_V1,
84 Facility,
85 LogLevel,
86 Message,
87 ClrInstanceID);
88
89 return ERROR_SUCCESS;
90}
91
92extern "C" BOOL EventXplatEnabledCLRStackWalkStress(){ return tracepoint_enabled(DotNETRuntimeStress, CLRStackWalkStress); }
93
94extern "C" ULONG FireEtXplatCLRStackWalkStress(
95 const unsigned short ClrInstanceID,
96 const unsigned char Reserved1,
97 const unsigned char Reserved2,
98 const unsigned int FrameCount,
99 const void** Stack)
100{
101 if (!EventXplatEnabledCLRStackWalkStress())
102 return ERROR_SUCCESS;
103
104 do_tracepoint(DotNETRuntimeStress,
105 CLRStackWalkStress,
106 ClrInstanceID,
107 Reserved1,
108 Reserved2,
109 FrameCount,
110 (const size_t*) Stack);
111
112 return ERROR_SUCCESS;
113}
114
115
116