diff --git a/src/.gitattributes b/.gitattributes
similarity index 100%
rename from src/.gitattributes
rename to .gitattributes
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
new file mode 100644
index 0000000..207d9dc
--- /dev/null
+++ b/.github/workflows/dotnet.yml
@@ -0,0 +1,45 @@
+name: .NET
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+ workflow_dispatch:
+
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+ - name: Restore dependencies
+ run: dotnet restore ./src/
+ - name: Build
+ run: dotnet build ./src/ --no-restore
+ - name: Test
+ run: dotnet test ./src/ --no-build --verbosity normal
+
+ publish:
+ needs: build
+ runs-on: ubuntu-latest
+ environment: nuget
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: 6.0.x
+ - name: Build
+ run: dotnet pack --configuration Release ./src/ -o ./
+ - name: Publish
+ env:
+ API_KEY: ${{ secrets.NUGET_API_KEY }}
+ run: dotnet nuget push --api-key $API_KEY --source https://api.nuget.org/v3/index.json *.nupkg
+
diff --git a/src/.gitignore b/.gitignore
similarity index 100%
rename from src/.gitignore
rename to .gitignore
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..e69de29
diff --git a/samples/PicoSampleApp/PicoSampleApp.csproj b/samples/PicoSampleApp/PicoSampleApp.csproj
new file mode 100644
index 0000000..c392ecb
--- /dev/null
+++ b/samples/PicoSampleApp/PicoSampleApp.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/samples/PicoSampleApp/PicoSampleApp.sln b/samples/PicoSampleApp/PicoSampleApp.sln
new file mode 100644
index 0000000..035ef8b
--- /dev/null
+++ b/samples/PicoSampleApp/PicoSampleApp.sln
@@ -0,0 +1,37 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34322.80
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PicoSampleApp", "PicoSampleApp.csproj", "{CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PicoProfiler.Logging", "..\..\src\PicoProfiler.Logging\PicoProfiler.Logging.csproj", "{BEECD099-7C81-4133-8FCE-1C56B1BDED88}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PicoProfiler", "..\..\src\PicoProfiler\PicoProfiler.csproj", "{F56EF65C-0B2B-4364-9ADB-092FD1BDF715}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CAB0DF19-22C1-4D00-AFF3-8B289B0880BF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BEECD099-7C81-4133-8FCE-1C56B1BDED88}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F56EF65C-0B2B-4364-9ADB-092FD1BDF715}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {CF720C8F-3DB6-475E-81AE-D9567D54D46D}
+ EndGlobalSection
+EndGlobal
diff --git a/samples/PicoSampleApp/Program.cs b/samples/PicoSampleApp/Program.cs
new file mode 100644
index 0000000..6f8c1b0
--- /dev/null
+++ b/samples/PicoSampleApp/Program.cs
@@ -0,0 +1,19 @@
+using PicoProfiler.ConsoleOutput;
+
+namespace PicoSampleApp;
+
+internal class Program
+{
+ static async Task Main(string[] args)
+ {
+ await RunConsoleSample();
+ }
+
+ private static async Task RunConsoleSample()
+ {
+ using var _ = PicoProfilerConsoleOutput.Start();
+ await MyTimeConsumingWork();
+ }
+
+ private static async Task MyTimeConsumingWork() => await Task.Delay(TimeSpan.FromMilliseconds(374));
+}
\ No newline at end of file
diff --git a/src/PicoProfiler.Logging/PicoProfiler.Logging.csproj b/src/PicoProfiler.Logging/PicoProfiler.Logging.csproj
index 19ac0c4..299daa4 100644
--- a/src/PicoProfiler.Logging/PicoProfiler.Logging.csproj
+++ b/src/PicoProfiler.Logging/PicoProfiler.Logging.csproj
@@ -4,6 +4,12 @@
net6.0
enable
enable
+
+ PicoProfiler.Logging
+ PicoProfiler;Profiler;Pico;Logging;Micro;Profiling;Lightweight;Performance
+ https://github.com/migajek/PicoProfiler
+ Integrates PicoProfiler with Microsoft.Extensions.Logging
+ 0.2.0
diff --git a/src/PicoProfiler/ConsoleOutput/ConsoleOutputConfiguration.cs b/src/PicoProfiler/ConsoleOutput/ConsoleOutputConfiguration.cs
index 94522f2..cb7ce4b 100644
--- a/src/PicoProfiler/ConsoleOutput/ConsoleOutputConfiguration.cs
+++ b/src/PicoProfiler/ConsoleOutput/ConsoleOutputConfiguration.cs
@@ -9,5 +9,5 @@ private ConsoleOutputConfiguration()
}
public ConsoleMessageFactoryWithActionName DefaultMessageFactory { get; set; }
- = (actionName, elapsedTime) => "";
+ = (actionName, elapsedTime) => $"{actionName} finished in {elapsedTime.TotalMilliseconds:.##} ms";
}
\ No newline at end of file
diff --git a/src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs b/src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs
index 2e1f2b7..a5eeded 100644
--- a/src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs
+++ b/src/PicoProfiler/ConsoleOutput/PicoProfilerConsoleOutput.cs
@@ -11,4 +11,12 @@ public static IPicoProfiler Create([CallerMemberName] string actionName = null,
return Profiler.Create(time => Console.WriteLine(factory(actionName, time)));
}
+
+ public static IPicoProfiler Start([CallerMemberName] string actionName = null,
+ ConsoleMessageFactoryWithActionName? messageFactory = null)
+ {
+ var profiler = Create(actionName, messageFactory);
+ profiler.Start();
+ return profiler;
+ }
}
\ No newline at end of file
diff --git a/src/PicoProfiler/PicoProfiler.csproj b/src/PicoProfiler/PicoProfiler.csproj
index 132c02c..7303fa9 100644
--- a/src/PicoProfiler/PicoProfiler.csproj
+++ b/src/PicoProfiler/PicoProfiler.csproj
@@ -4,6 +4,12 @@
net6.0
enable
enable
+
+ PicoProfiler
+ PicoProfiler;Profiler;Pico;Micro;Profiling;Lightweight;Peformance
+ https://github.com/migajek/PicoProfiler
+ Tiny abstraction layer over Stopwatch, leveraging IDisposable and enabling using pattern usage
+ 0.2.0
-
+
\ No newline at end of file