tcc/scripts/common.py

48 lines
1.5 KiB
Python
Raw Permalink Normal View History

2023-11-09 02:21:52 +00:00
import json
2023-11-04 20:05:55 +00:00
import person_pb2
2023-11-02 22:14:16 +00:00
2023-11-04 20:05:55 +00:00
person_proto = person_pb2.Person()
person_proto.name = "John Doe"
person_proto.age = 30
person_proto.friends.extend(["Jane Doe", "John Smith"])
person_proto.email = "john.doe@email.com"
person_proto.phone = "123-456-7890"
person_proto = person_proto.SerializeToString()
person_json = {
"name": "John Doe",
"age": 30,
"friends": ["Jane Doe", "John Smith"],
"email": "john.doe@email.com",
"phone": "123-456-7890"
}
2023-11-09 02:21:52 +00:00
person_json = json.dumps(person_json)
2023-11-02 22:14:16 +00:00
2023-10-03 18:31:33 +00:00
FRAMEWORKS = [
2023-11-09 02:21:52 +00:00
('Actix', 'tcc-actix', 'orange'),
('ASP.NET', 'tcc-aspnet', 'blue'),
('Flask', 'tcc-flask', 'grey'),
2023-11-05 00:23:46 +00:00
('Express', 'tcc-express', 'red'),
2023-11-09 02:21:52 +00:00
('Spring', 'tcc-spring', 'green'),
2023-10-03 18:31:33 +00:00
]
ENDPOINTS = {
'Actix': 'http://localhost:9083',
'ASP.NET': 'http://localhost:9081',
'Flask': 'http://localhost:9082',
'Express': 'http://localhost:9084',
2023-10-30 23:34:20 +00:00
'Spring': 'http://localhost:9085',
2023-10-03 18:31:33 +00:00
}
2024-03-24 22:31:53 +00:00
AVG_RUNS = 30
2023-11-04 20:05:55 +00:00
2023-10-03 18:31:33 +00:00
API_REQUESTS = [
2023-11-09 02:21:52 +00:00
('/status/ok', 'GET', range(0, 30_000, 5000), None),
('/simulation/harmonic-progression?n=100000', 'GET', range(0, 30_000, 5000), None),
2024-03-24 22:31:53 +00:00
('/simulation/json', 'POST', range(0, 30_000, 5000), (person_json, "application/json")),
('/simulation/protobuf', 'POST', range(0, 30_000, 5000), (person_proto, "application/protobuf")),
2023-11-09 02:21:52 +00:00
('/image/save-big-image', 'POST', range(0, 500, 50), (open('big-image.png', 'rb').read(), "image/png")),
('/static/small-image.png', 'GET', range(0, 30_000, 5000), None),
('/static/big-image.png', 'GET', range(0, 500, 50), None),
2023-10-29 22:01:24 +00:00
]