melhorando

This commit is contained in:
José Henrique Ivanchechen 2023-08-25 09:24:01 -03:00
parent 32a38fe48c
commit 81abfe0c30
3 changed files with 10 additions and 6 deletions

View File

@ -34,11 +34,11 @@ namespace TCC.Controllers
[HttpGet("load-image")]
public async Task<IActionResult> 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");
}

View File

@ -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:

View File

@ -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)