Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit c7d4af1

Browse files
committed
WPERF-977 feat: add JSON deserialization for SPE
See merge request Linaro/WindowsPerf/vs-extension!104 === ChangeLog === * feat: add JSON deserialization for SPE
1 parent 6970a01 commit c7d4af1

File tree

3 files changed

+53
-3
lines changed

3 files changed

+53
-3
lines changed

WindowsPerfGUI/SDK/WperfOutputs/WperfCounting.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public partial class WperfCounting
4545
public Dsu Dsu { get; set; }
4646

4747
[JsonProperty(
48-
"time_elapsed",
48+
"Time_elapsed",
4949
Required = Required.DisallowNull,
5050
NullValueHandling = NullValueHandling.Ignore
5151
)]
@@ -54,10 +54,10 @@ public partial class WperfCounting
5454

5555
public partial class Core
5656
{
57-
[JsonProperty("kernel_mode", Required = Required.Always)]
57+
[JsonProperty("Kernel_mode", Required = Required.Always)]
5858
public bool KernelMode { get; set; }
5959

60-
[JsonProperty("multiplexing", Required = Required.Always)]
60+
[JsonProperty("Multiplexing", Required = Required.Always)]
6161
public bool Multiplexing { get; set; }
6262

6363
[JsonProperty("overall", Required = Required.Always)]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// BSD 3-Clause License
2+
//
3+
// Copyright (c) 2022, Arm Limited
4+
// All rights reserved.
5+
//
6+
// Redistribution and use in source and binary forms, with or without
7+
// modification, are permitted provided that the following conditions are met:
8+
//
9+
// 1. Redistributions of source code must retain the above copyright notice, this
10+
// list of conditions and the following disclaimer.
11+
//
12+
// 2. Redistributions in binary form must reproduce the above copyright notice,
13+
// this list of conditions and the following disclaimer in the documentation
14+
// and/or other materials provided with the distribution.
15+
//
16+
// 3. Neither the name of the copyright holder nor the names of its
17+
// contributors may be used to endorse or promote products derived from
18+
// this software without specific prior written permission.
19+
//
20+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
namespace WindowsPerfGUI.SDK.WperfOutputs
32+
{
33+
using Newtonsoft.Json;
34+
35+
public partial class WperfSPE
36+
{
37+
[JsonProperty("sampling")]
38+
public WperfSampling Sampling { get; set; }
39+
40+
[JsonProperty("counting")]
41+
public WperfCounting Counting { get; set; }
42+
}
43+
public partial class WperfSPE
44+
{
45+
public static WperfSPE FromJson(string json) =>
46+
JsonConvert.DeserializeObject<WperfSPE>(json, JsonSettings.Settings);
47+
}
48+
49+
}

WindowsPerfGUI/WindowsPerfGUI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
<DependentUpon>WperfHostDataLanguagePack.resx</DependentUpon>
112112
</Compile>
113113
<Compile Include="SDK\WperfOutputs\WperfCounting.cs" />
114+
<Compile Include="SDK\WperfOutputs\WperfSPE.cs" />
114115
<Compile Include="ToolWindows\CountingSetting\CountingEvent.cs" />
115116
<Compile Include="SDK\WperfOutputs\WperfTimeline.cs" />
116117
<Compile Include="ToolWindows\SamplingExplorer\LineHighlighting\HighlighterDict.cs" />

0 commit comments

Comments
 (0)