@manhng

Welcome to my blog!

Time Logger

October 23, 2021 18:22

Time Logger (edit)

.NET Standard 2.0

.NET Standard | Microsoft Docs

.NET Standard Explained: How To Share Code – Stackify

.NET Standard | Common APIs across all .NET implementations (microsoft.com)

Cross-platform targeting for .NET libraries | Microsoft Docs

.NET Framework 4.6.1

Download Microsoft .NET Framework 4.6.1 (Web Installer) for Windows 7 SP1, Windows 8, Windows 8.1, Windows 10, Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2 from Official Microsoft Download Center

Download Microsoft .NET Framework 4.6.1 (Offline Installer) for Windows 7 SP1, Windows 8, Windows 8.1, Windows 10, Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2 from Official Microsoft Download Center

References

BenchmarkDotNet

BenchmarkDotNet (dotnetfoundation.org)

Creating a Nuget Package - Step by Step - CodeProject

GitHub - dotnet/BenchmarkDotNet: Powerful .NET library for benchmarking

References

nuget.exe pack -IncludeReferencedProjects -properties Configuration=Release

gtechsltn/TimeLogger: Stopwatch | TimeLogger | TimeMeasurer | Stopwatcher | OneTimeStopwatch (github.com)

Snippet

# Performance Time Logging Tool
+ Performance Tuning
+ Benchmarking with Stopwatch
+ Stopwatch is a class in C# to measure the elapsed time

# Pros & Cons
## Pros
+ Making it easier to time your code
+ Making it easier to measure execution time of small code snippets
+ Reporting made easier in the text log file
+ Using with Performance Profiler together
+ Visual Studio > Menu > Debug > Performance Profiler, and select Performance Wizard
    + CPU Usage
    + GPU Usage
    + Memory Usage
    + Performance Wizard (a.k.a Visual Studio Profiler)

## Cons
+ Cross-platform (written in C# and .NET Standard 2.0)
+ Requires .NET Framework 4.6.1 + Cannot use in the Asynchronous programming # Usage + **TimeLogger.Init**("name_of_method"); + **TimeLogger.Start**("code_block_1");     + if (USE_V1) {     + ... //code need to optimize     + }     + else {     + ... //code optimized     + } + **TimeLogger.Stop**("code_block_1"); + ... + **TimeLogger.Start**("code_block_n");     + if (USE_V1) {     + ... //code need to optimize     + }     + else {     + ... //code optimized     + } + **TimeLogger.Stop**("code_block_n"); + **TimeLogger.Summary**(); # References + Benchmarking with Stopwatch + http://jigneshon.blogspot.com/2013/09/c-benchmarking-with-stopwatch-beginner.html + Extending Stopwatch: Making it easier to time your code + http://blog.functionalfun.net/2008/06/extending-stopwatch.html + C# Stopwatch Extension + https://grumpycodedude.com/2018/03/30/c-stopwatch-extension/ + Standardization of Performance Monitoring, Logging, & Exception Handling via a .NET Runtime Wrapper + https://hackernoon.com/standardization-of-performance-monitoring-logging-and-exception-handling-via-a-net-runtime-wrapper-fe9l3sxs + A simple but effective mini-profiler for ASP.NET (and Core) websites + https://github.com/MiniProfiler/dotnet + A .NET Core Profiling Library + https://github.com/teddymacn/CoreProfiler + OpenCover: A code coverage tool for .NET 2 and above (WINDOWS OS only), support for 32 and 64 processes with both branch and sequence points + https://github.com/OpenCover/opencover + BenchmarkDotNet: Powerful .NET library for benchmarking + https://github.com/dotnet/BenchmarkDotNet + Performance Testing In Visual Studio 2019 + https://www.c-sharpcorner.com/article/performance-testing-in-visual-studio-2019/ + How to profile performance issues using Visual Studio's built-in Performance Profiler + https://supportcenter.devexpress.com/ticket/details/t802150/how-to-profile-performance-issues-using-visual-studio-s-built-in-performance-profiler + How to Troubleshoot Performance with a Visual Studio Profiler + https://stackify.com/how-to-troubleshoot-performance-with-a-visual-studio-profiler/ + Stackify Prefix: Improving the performance of your applications before you even submit the pull request is easy with Prefix. + https://docs.stackify.com/docs/prefix-getting-started + Stackify Retrace: APM + Errors + Logging + Metrics + https://stackify.com/retrace/ + Retrace works out of the box with your .NET, PHP, Node.js, Ruby, Python, and Java stack, and dozens of common frameworks are supported, including:     + SQL Server, Oracle, PostgreSQL, MySQL     + MongoDB     + Elasticsearch     + Redis     + AWS, Azure + AMD CodeXL + JetBrains dotTrace + RedGate ANTS Performance Profiler + Telerik JustTrace

Nuget Package Logo

Categories

Recent posts