Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sampling available system memory #147

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Aeon.Acquisition/Aeon.Acquisition.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageTags>Bonsai Rx Project Aeon Acquisition</PackageTags>
<TargetFramework>net472</TargetFramework>
<VersionPrefix>0.5.0</VersionPrefix>
<VersionSuffix>build230921</VersionSuffix>
<VersionSuffix>build230922</VersionSuffix>
</PropertyGroup>

<ItemGroup>
Expand Down
21 changes: 21 additions & 0 deletions src/Aeon.Acquisition/AvailableMemory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Bonsai;
using System;
using System.ComponentModel;
using System.Linq;
using System.Reactive.Linq;

namespace Aeon.Acquisition
{
[Combinator]
[Description("Samples a performance counter reporting the available system memory, in megabytes.")]
[WorkflowElementCategory(ElementCategory.Transform)]
public class AvailableMemory
{
public IObservable<float> Process<TSource>(IObservable<TSource> source)
{
return Observable.Using(
() => new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes"),
performance => source.Select(_ => performance.NextValue()));
}
}
}
Loading