-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
167 lines (153 loc) · 6.99 KB
/
Program.cs
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
using System;
using System.Collections.Generic;
using System.Linq;
using ConsoleUtilities;
using NvAPIWrapper;
using NvAPIWrapper.Display;
using NvAPIWrapper.GPU;
using NvAPIWrapper.Mosaic;
namespace NvAPISample2
{
internal class Program
{
// ReSharper disable once TooManyDeclarations
private static void Main()
{
NVIDIA.Initialize();
var navigation = new Dictionary<object, Action>
{
{"Connected Displays", PrintConnectedDisplays},
{"Disconnected Displays", PrintDisconnectedDisplays},
{"Display Configurations", PrintDisplayPathInformation},
{"Physical GPUs", PrintPhysicalGPUs},
{"GPU Temperatures", PrintGPUSensors},
{"GPU Coolers", PrintGPUCoolers},
{"GPU Performance States", PrintGPUPerformanceStates},
{"TCC GPUs", PrintTCCGPUs},
{"Grid Topologies (Mosaic - NVIDIA Surround)", PrintGridTopologies},
{"NVIDIA Driver and API version", PrintDriverVersion},
{"System Chipset Information", PrintChipsetInformation},
{"Lid and Dock Information", PrintDockInformation}
};
ConsoleNavigation.Default.PrintNavigation(
navigation.Keys.ToArray(),
(i, o) => navigation[o](),
"Select an execution line to browse NvAPIWrapper functionalities."
);
}
private static void PrintChipsetInformation()
{
ConsoleWriter.Default.PrintCaption("NVIDIA.ChipsetInfo");
ConsoleWriter.Default.WriteObject(new
{
NVIDIA.ChipsetInfo.ChipsetName,
NVIDIA.ChipsetInfo.DeviceId,
NVIDIA.ChipsetInfo.Flags,
NVIDIA.ChipsetInfo.VendorId,
NVIDIA.ChipsetInfo.VendorName
});
}
private static void PrintConnectedDisplays()
{
ConsoleWriter.Default.PrintCaption("Display.GetDisplays()");
var a = Display.GetDisplays();
Console.Write(Display.GetDisplays()[0].Handle);
ConsoleNavigation.Default.PrintNavigation(Display.GetDisplays(),
(i, display) => ConsoleWriter.Default.WriteObject(display),
"Select a display to show device information");
}
private static void PrintDisconnectedDisplays()
{
ConsoleWriter.Default.PrintCaption("UnAttachedDisplay.GetUnAttachedDisplays()");
var b = UnAttachedDisplay.GetUnAttachedDisplays();
Console.Write(UnAttachedDisplay.GetUnAttachedDisplays()[0].Handle);
ConsoleNavigation.Default.PrintNavigation(UnAttachedDisplay.GetUnAttachedDisplays(),
(i, unAttachedDisplay) => ConsoleWriter.Default.WriteObject(unAttachedDisplay, 0),
"Select a display to show additional information");
}
private static void PrintDisplayPathInformation()
{
ConsoleWriter.Default.PrintCaption("PathInfo.GetDisplaysConfig()");
ConsoleNavigation.Default.PrintNavigation(PathInfo.GetDisplaysConfig().ToArray(), (i, info) =>
{
ConsoleWriter.Default.WriteObject(info, 2);
}, "Select a path info to show additional information");
}
private static void PrintDockInformation()
{
ConsoleWriter.Default.PrintCaption("NVIDIA.LidAndDockParameters");
ConsoleWriter.Default.WriteObject(new
{
NVIDIA.LidAndDockParameters.CurrentDockPolicy,
NVIDIA.LidAndDockParameters.CurrentDockState,
NVIDIA.LidAndDockParameters.CurrentLidPolicy,
NVIDIA.LidAndDockParameters.CurrentLidState,
NVIDIA.LidAndDockParameters.ForcedDockMechanismPresent,
NVIDIA.LidAndDockParameters.ForcedLidMechanismPresent
});
}
private static void PrintDriverVersion()
{
ConsoleWriter.Default.PrintCaption("NVIDIA");
ConsoleWriter.Default.WriteObject(new
{
NVIDIA.DriverVersion,
NVIDIA.DriverBranchVersion,
NVIDIA.InterfaceVersionString
});
}
private static void PrintGPUCoolers()
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.CoolerInformation");
ConsoleWriter.Default.WriteObject(gpu.CoolerInformation.Coolers.ToArray());
}, "Select a GPU to show cooler values");
}
private static void PrintGPUPerformanceStates()
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.PerformanceStatesInfo");
ConsoleWriter.Default.WriteObject(gpu.PerformanceStatesInfo, 3);
}, "Select a GPU to show performance states configuration");
}
private static void PrintGPUSensors()
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.ThermalSensors");
ConsoleWriter.Default.WriteObject(gpu.ThermalInformation.ThermalSensors.ToArray());
}, "Select a GPU to show thermal sensor values");
}
private static void PrintGridTopologies()
{
ConsoleWriter.Default.PrintCaption("GridTopology.GetGridTopologies()");
ConsoleNavigation.Default.PrintNavigation(GridTopology.GetGridTopologies(), (i, topology) =>
{
ConsoleWriter.Default.WriteObject(topology, 3);
}, "Select a grid topology to show additional information");
}
private static void PrintPhysicalGPUs()
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
{
ConsoleWriter.Default.WriteObject(gpu, 0);
}, "Select a GPU to show additional information");
}
// ReSharper disable once InconsistentNaming
// ReSharper disable once IdentifierTypo
private static void PrintTCCGPUs()
{
ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetTCCPhysicalGPUs()");
ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetTCCPhysicalGPUs(), (i, gpu) =>
{
ConsoleWriter.Default.WriteObject(gpu, 0);
}, "Select a GPU to show additional information");
}
}
}