summaryrefslogtreecommitdiff
path: root/src/vm/diagnosticserver.h
blob: adab6e0a9f69a6ff571038a68303c45e88ea9364 (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
// 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 __DIAGNOSTIC_SERVER_H__
#define __DIAGNOSTIC_SERVER_H__

#ifdef FEATURE_PERFTRACING // This macro should change to something more generic than performance.

#include "diagnosticsipc.h"

enum class DiagnosticMessageType : uint32_t
{
    ///////////////////////////////////////////////////////////////////////////
    // Debug = 0
    GenerateCoreDump = 1,           // Initiates core dump generation

    ///////////////////////////////////////////////////////////////////////////
    // EventPipe = 1024
    StartEventPipeTracing = 1024,   // To file
    StopEventPipeTracing,
    CollectEventPipeTracing,        // To IPC

    ///////////////////////////////////////////////////////////////////////////
    // Profiler = 2048
    AttachProfiler = 2048,
};

struct MessageHeader
{
    DiagnosticMessageType RequestType;
    uint32_t Pid;
};

//! Defines an implementation of a IPC handler that dispatches messages to the runtime.
class DiagnosticServer final
{
public:
    //! Initialize the event pipe (Creates the EventPipe IPC server).
    static bool Initialize();

    //! Shutdown the event pipe.
    static bool Shutdown();

private:
    static IpcStream::DiagnosticsIpc *s_pIpc;
};

#endif // FEATURE_PERFTRACING

#endif // __DIAGNOSTIC_SERVER_H__