From ffe344085522c1c18f304ea5af3e97e71815a163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Habinshuti?= Date: Wed, 29 Jan 2025 12:29:12 +0300 Subject: [PATCH] Fix bug in perf analysis sample --- DotNetPerfAnalysisIntro/README.md | 13 +++++++++++++ DotNetPerfAnalysisIntro/SampleApi/DataReader.cs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/DotNetPerfAnalysisIntro/README.md b/DotNetPerfAnalysisIntro/README.md index a008c2a..b529546 100644 --- a/DotNetPerfAnalysisIntro/README.md +++ b/DotNetPerfAnalysisIntro/README.md @@ -4,3 +4,16 @@ This sample project aims to demonstrate how to analyze and improve the performan service using Visual Studio profilers. In this exercise we attempt to improve the latency and throughput of a simple API. + +To run the load test: + +```sh +cd load-tests +k6 run --vus --duration ./basic.js +``` + +e.g. + +```sh +k6 run --vus 200 --duration 30s ./basic.js +``` diff --git a/DotNetPerfAnalysisIntro/SampleApi/DataReader.cs b/DotNetPerfAnalysisIntro/SampleApi/DataReader.cs index 6c12e49..4d9d028 100644 --- a/DotNetPerfAnalysisIntro/SampleApi/DataReader.cs +++ b/DotNetPerfAnalysisIntro/SampleApi/DataReader.cs @@ -24,7 +24,7 @@ public static async Task> ReadDataAsync(Stream input) } else if (word.StartsWith("temp:")) { - temperature = double.Parse(word.Split(':')[1]); + double.TryParse(word.Split(':')[1], out temperature); } }