Skip to content

Commit 07f45bd

Browse files
committed
Submit all code
1 parent 1d5efdd commit 07f45bd

File tree

102 files changed

+7474
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+7474
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.vs/
2+
**/bin/Debug/
3+
**/bin/Release/
4+
**/obj/Debug/
5+
**/obj/Release/
6+
*.csproj.user

Builds/SignalVisualizer_1.0.0.zip

77.4 KB
Binary file not shown.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.ComponentModel.Composition;
3+
using System.Diagnostics;
4+
using System.Threading;
5+
using System.Threading.Tasks;
6+
using SignalVisualizer.Contracts;
7+
8+
namespace CpuDataSourceExtension
9+
{
10+
[Export(typeof(IDataSource))]
11+
public class CpuDataSource : DataSourceBase
12+
{
13+
public override string Name { get; } = "CPU meter";
14+
public override uint Version { get; } = 1;
15+
public override Guid UniqueIdentifier { get; } = new Guid("3c77228a-f646-4ce2-836b-d68e707f68a8");
16+
public override string[] ComponentNames { get; } = new string[] { "Processor time (%)", "Idle time (%)" };
17+
18+
public override async Task Start(CancellationToken cancellationToken)
19+
{
20+
// allocates the storage for the values of the two components of the data source
21+
var values = new double[2];
22+
23+
// create performance counters
24+
var totalCpu = new PerformanceCounter("Processor", "% Processor Time", "_Total", true);
25+
var currentProcessCpu = new PerformanceCounter("Processor", "% Idle Time", "_Total", true);
26+
27+
// iterate while not cancelled
28+
while (cancellationToken.IsCancellationRequested == false)
29+
{
30+
// sample the performance counters values
31+
values[0] = totalCpu.NextValue();
32+
values[1] = currentProcessCpu.NextValue();
33+
34+
// notify SignalVisualizer that a new value has been produced
35+
NotifyNext(values);
36+
37+
// awaits to avoid burn out, then loop and restart
38+
await Task.Delay(250);
39+
}
40+
}
41+
}
42+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{0C589A68-BA92-4334-A711-E2F9E1025817}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>CpuDataSourceExtension</RootNamespace>
11+
<AssemblyName>CpuDataSourceExtension</AssemblyName>
12+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.ComponentModel.Composition" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Xml" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="CpuDataSource.cs" />
44+
<Compile Include="Properties\AssemblyInfo.cs" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<ProjectReference Include="..\SignalVisualizer.Contracts\SignalVisualizer.Contracts.csproj">
48+
<Project>{5c3c2e64-5e96-45d2-b58c-e46692699aaf}</Project>
49+
<Name>SignalVisualizer.Contracts</Name>
50+
</ProjectReference>
51+
</ItemGroup>
52+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
53+
<PropertyGroup>
54+
<PostBuildEvent>mkdir "$(SolutionDir)$(SolutionName)\$(OutDir)Extensions" &amp; copy "$(TargetPath)" "$(SolutionDir)$(SolutionName)\$(OutDir)Extensions\$(TargetFileName)"
55+
</PostBuildEvent>
56+
</PropertyGroup>
57+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyTitle("CpuDataSourceExtension")]
4+
[assembly: AssemblyDescription("")]
5+
[assembly: AssemblyProduct("CpuDataSourceExtension")]
6+
[assembly: AssemblyCopyright("Copyright © Sebastien ROBERT")]
7+
8+
[assembly: AssemblyVersion("1.0.0.0")]
28.7 KB
Loading
68.5 KB
Loading
2.94 KB
Loading

Documentation/images/data_sources.png

14.1 KB
Loading
38.2 KB
Loading

0 commit comments

Comments
 (0)