From 81abfe0c30f4d8a239ed40cb8bbd09d0eebeba8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Henrique=20Ivanchechen?= Date: Fri, 25 Aug 2023 09:24:01 -0300 Subject: [PATCH] melhorando --- ASP.NET/Controllers/ImageController.cs | 8 ++++---- scripts/graph.py | 2 ++ scripts/testes.py | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ASP.NET/Controllers/ImageController.cs b/ASP.NET/Controllers/ImageController.cs index ec6ea91..ffbd67e 100644 --- a/ASP.NET/Controllers/ImageController.cs +++ b/ASP.NET/Controllers/ImageController.cs @@ -34,11 +34,11 @@ namespace TCC.Controllers [HttpGet("load-image")] public async Task GetSimpleImage() { - //var result = ImageService.GetSimpleImage(); - var result = System.IO.File.ReadAllBytes("simpleimage.png"); + var result = ImageService.GetSimpleImage(); - var imageStream = new byte[result.Length]; - result.CopyTo(imageStream, 0); + var imageStream = new MemoryStream(); + result.Write(imageStream); + imageStream.Position = 0; return File(imageStream, "image/png"); } diff --git a/scripts/graph.py b/scripts/graph.py index 674c6d4..c81e09d 100644 --- a/scripts/graph.py +++ b/scripts/graph.py @@ -7,6 +7,8 @@ def plot_graph(x, y, title, x_label, y_label, filename): plt.ylabel(y_label) plt.savefig(f'{filename}.png') + plt.clf() + def getData(filename): lines = [] with open(filename, 'r') as f: diff --git a/scripts/testes.py b/scripts/testes.py index f85ce30..c38f0c3 100644 --- a/scripts/testes.py +++ b/scripts/testes.py @@ -16,7 +16,8 @@ ENDPOINTS = [ '/image/load-image', ] -num_requests = [10, 1000, 5000, 10_000, 50_000, 100_000, 500_000, 1_000_000] +#num_requests = [10, 1000, 5000, 10_000, 50_000, 100_000, 500_000, 1_000_000] +num_requests = range(0, 50_000, 5000) def send_request(url): success = False @@ -41,7 +42,7 @@ def run_tests(endpoint): if os.path.exists(filename): os.remove(filename) - for num_request in range(0, 50_000, 5000): + for num_request in num_requests: if num_request <= 0: continue with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: @@ -65,4 +66,5 @@ def run_tests(endpoint): time.sleep(3) for endpoint in ENDPOINTS: + print(f"# {endpoint}") run_tests(endpoint)