Compare commits

..

No commits in common. "d5d2ab4956d077f1a158178945fa203a07699604" and "bba35341fb70d9532ee97693d761a6d1a219f60f" have entirely different histories.

9 changed files with 5 additions and 81 deletions

View File

@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using TCC.Services;
namespace TCC.Controllers
{
[ApiController]
[Route("simulation")]
public class SimulationController : ControllerBase
{
public SimulationController()
{
}
[HttpGet("harmonic-progression")]
public async Task<IActionResult> GetHarmonicProgression([FromQuery] int n)
{
float sum = 0;
for (int i = 1; i <= n; i++)
{
sum += 1.0f / i;
}
return Ok(sum);
}
}
}

View File

@ -15,13 +15,11 @@ RUN cd out && \
wget https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png && \
wget https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png && \
wget https://files.ivanch.me/api/public/dl/nAndfAjK/video.mp4 && \
wget https://files.ivanch.me/api/public/dl/RzXwJG7o/nginx.html && \
rm -rf runtimes && \
mkdir -p ./static && \
mv small-image.png ./static && \
mv big-image.png ./static && \
mv video.mp4 ./static && \
mv nginx.html ./static
mv video.mp4 ./static
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim

View File

@ -18,8 +18,7 @@ WORKDIR /app
RUN wget https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png && \
wget https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png && \
wget https://files.ivanch.me/api/public/dl/nAndfAjK/video.mp4 && \
wget https://files.ivanch.me/api/public/dl/RzXwJG7o/nginx.html
wget https://files.ivanch.me/api/public/dl/nAndfAjK/video.mp4
COPY . .
@ -28,7 +27,6 @@ RUN cargo build --release && \
mv small-image.png ./static && \
mv big-image.png ./static && \
mv video.mp4 ./static && \
mv nginx.html ./static && \
ldconfig /usr/local/lib
ENV LD_LIBRARY_PATH=/usr/local/lib

View File

@ -15,20 +15,6 @@ async fn static_serve(req: HttpRequest) -> Result<NamedFile> {
Ok(NamedFile::open(real_path)?)
}
#[get("/simulation/harmonic-progression")]
async fn simulation_harmonic_progression(req: HttpRequest) -> impl Responder {
let query_str = req.query_string();
let qs = QString::from(query_str);
let radius = qs.get("n").unwrap_or("1").parse::<f64>().unwrap_or(1.0);
let mut sum = 0.0;
for i in 1..=radius as i32 {
sum += 1.0 / i as f64;
}
HttpResponse::Ok().body(format!("{}", sum))
}
#[get("/image/load-small-image")]
async fn load_small_image() -> Result<NamedFile> {
let real_path = "static/small-image.png";
@ -88,7 +74,6 @@ async fn main() -> std::io::Result<()> {
.service(load_big_image)
.service(save_big_image)
.service(blur_image)
.service(simulation_harmonic_progression)
.app_data(web::PayloadConfig::new(1024 * 1024 * 1024))
})
.bind(("0.0.0.0", 5000))?

View File

@ -11,13 +11,11 @@ RUN apt-get update && apt-get install -y imagemagick && apt-get install -y wget
RUN wget https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png && \
wget https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png && \
wget https://files.ivanch.me/api/public/dl/nAndfAjK/video.mp4 && \
wget https://files.ivanch.me/api/public/dl/RzXwJG7o/nginx.html && \
rm -rf runtimes && \
mkdir -p ./static && \
mv small-image.png ./static && \
mv big-image.png ./static && \
mv video.mp4 ./static && \
mv nginx.html ./static
mv video.mp4 ./static
COPY . .

View File

@ -1,13 +1,11 @@
from flask import Flask
from controllers.status import status_blueprint
from controllers.simulation import simulation_blueprint
from controllers.image import image_blueprint
app = Flask(__name__)
#
app.register_blueprint(status_blueprint)
app.register_blueprint(simulation_blueprint)
app.register_blueprint(image_blueprint)
if __name__ == '__main__':

View File

@ -1,23 +0,0 @@
from flask import request, Blueprint
simulation_blueprint = Blueprint('simulation_blueprint', __name__)
class SimulationController:
def __init__(self):
pass
def harmonic_progression(self, n):
sum = 0
for i in range(1, n):
sum += 1/i
return sum
simulation_controller = SimulationController()
@simulation_blueprint.route('/simulation/harmonic-progression', methods=['GET'])
def return_ok():
n = int(request.args.get('n'))
sum = simulation_controller.harmonic_progression(n)
return str(sum), 200

View File

@ -17,13 +17,11 @@ AVG_RUNS = 3
API_REQUESTS = [
('/status/ok', 'GET', range(0, 30_000, 5000), None),
('/simulation/harmonic-progression?n=100000', 'GET', range(0, 30_000, 5000), None),
('/image/save-big-image', 'POST', range(0, 500, 50), open('big-image.png', 'rb').read()),
# (f'/image/blur?radius={BLUR_RADIUS}', 'POST', range(0, 500, 50), open('small-image.png', 'rb').read()),
('/image/save-big-image', 'POST', range(0, 10_000, 1_000), open('big-image.png', 'rb').read()),
(f'/image/blur?radius={BLUR_RADIUS}', 'POST', range(0, 1_000, 50), open('small-image.png', 'rb').read()),
('/image/load-small-image', 'GET', range(0, 30_000, 5000), None),
('/static/small-image.png', 'GET', range(0, 30_000, 5000), None),
('/image/load-big-image', 'GET', range(0, 500, 50), None),
('/static/big-image.png', 'GET', range(0, 500, 50), None),
('/static/video.mp4', 'GET', range(0, 10_000, 1_000), None),
('/static/nginx.html', 'GET', range(0, 30_000, 5000), None),
]

View File

@ -126,9 +126,7 @@ if __name__ == '__main__':
endpoint_file = endpoint_name.replace('/', '')
filename = f'data/resource_ASP.NET_{endpoint_file}.csv'
filename = filename.replace("?", "_")
generate_resource_graph(filename, framework_name, endpoint_name)
filename = f'data/req_ASP.NET_{endpoint_file}.csv'
filename = filename.replace("?", "_")
generate_req_graph(filename, framework_name, endpoint_name)