Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Portal - Add Message Size Parameter #115

Merged
merged 9 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions portal/mock-server/src/all-experiments.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,56 @@
{
"id": 354,
"algorithm": "prime256v1",
"iterations": 100
"iterations": 500,
"message_size": 2048
},
{
"id": 355,
"algorithm": "prime256v1",
"iterations": 500
"iterations": 100,
"message_size": 1024
},
{
"id": 356,
"algorithm": "prime256v1",
"iterations": 1000
"iterations": 1000,
"message_size": 1024
},
{
"id": 357,
"algorithm": "p256_kyber512",
"iterations": 100
"iterations": 100,
"message_size": 1024
},
{
"id": 358,
"algorithm": "p256_kyber512",
"iterations": 500
"iterations": 500,
"message_size": 2048
},
{
"id": 359,
"algorithm": "p256_kyber512",
"iterations": 1000
"iterations": 1000,
"message_size": 1024
},
{
"id": 360,
"algorithm": "bikel3",
"iterations": 100
"iterations": 100,
"message_size": 512
},
{
"id": 361,
"algorithm": "bikel3",
"iterations": 500
"iterations": 500,
"message_size": 1024
},
{
"id": 362,
"algorithm": "bikel3",
"iterations": 1000
"iterations": 1000,
"message_size": 512
}
]
},
Expand All @@ -59,17 +68,20 @@
{
"id": 363,
"algorithm": "kyber512",
"iterations": 1000
"iterations": 1000,
"message_size": 1024
},
{
"id": 364,
"algorithm": "bikel3",
"iterations": 1000
"iterations": 1000,
"message_size": 1024
},
{
"id": 365,
"algorithm": "prime256v1",
"iterations": 1000
"iterations": 1000,
"message_size": 2048
}
]
},
Expand All @@ -81,22 +93,26 @@
{
"id": 366,
"algorithm": "prime256v1",
"iterations": 500
"iterations": 500,
"message_size": 1024
},
{
"id": 367,
"algorithm": "bikel3",
"iterations": 1000
"iterations": 1000,
"message_size": 1024
},
{
"id": 368,
"algorithm": "bikel3",
"iterations": 1000
"iterations": 1000,
"message_size": 512
},
{
"id": 369,
"algorithm": "prime256v1",
"iterations": 5000
"iterations": 5000,
"message_size": 512
}
]
},
Expand All @@ -108,12 +124,14 @@
{
"id": 370,
"algorithm": "kyber512",
"iterations": 500
"iterations": 500,
"message_size": 1024
},
{
"id": 371,
"algorithm": "kyber512",
"iterations": 1500
"iterations": 1500,
"message_size": 1024
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions portal/mock-server/src/message_sizes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_sizes": [0, 1, 2, 100, 1024, 102400, 204800, 1048576, 2097152, 10485760]
}
8 changes: 8 additions & 0 deletions portal/mock-server/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ router.get('/iterations', async (req: Request, res: Response) => {
}, 1500);
});

router.get('/message_sizes', async (req: Request, res: Response) => {
ohadkoren marked this conversation as resolved.
Show resolved Hide resolved
console.log(`-${req.method} ${req.url}`);
const data = (await import('./message_sizes.json')).default;
setTimeout(() => {
res.json(data);
}, 1500);
});

router.get('/qujata-api/test_suites/:testSuiteId', async (req: Request, res: Response) => {
console.log(`-${req.method} ${req.url}`);
const data = (await import('./test.json')).default;
Expand Down
5 changes: 4 additions & 1 deletion portal/mock-server/src/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"operatingSystem": "RELACE_WITH_OPERATING_SYSTEM",
"resourceName": "RELACE_WITH_RESOURCE_NAME"
},

"test_runs": [
{
"id":1,
"algorithm": "bikel1",
"iterations": 1000,
"message_size": 1024,
"results": {
"averageCPU": 3.5,
"averageMemory": 3
Expand All @@ -29,6 +29,7 @@
"id":2,
"algorithm": "bikel1",
"iterations": 2000,
"message_size": 2048,
"results": {
"averageCPU": 7.0,
"averageMemory": 6
Expand All @@ -38,6 +39,7 @@
"id":3,
"algorithm": "kyber512",
"iterations": 1000,
"message_size": 1024,
"results": {
"averageCPU": 1.7,
"averageMemory": 2
Expand All @@ -47,6 +49,7 @@
"id":4,
"algorithm": "kyber512",
"iterations": 2000,
"message_size": 1024,
"results": {
"averageCPU": 2.6,
"averageMemory": 2
Expand Down
1 change: 1 addition & 0 deletions portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"chartjs-plugin-annotation": "^3.0.1",
"classnames": "^2.3.2",
"date-fns": "^3.3.0",
"filesize": "^10.1.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-chartjs-2": "3.1.1",
Expand Down
2 changes: 2 additions & 0 deletions portal/src/app/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const APIS: { [key in keyof typeof API_URLS]: string } = {
analyze: 'analyze',
algorithms: 'algorithms',
iterations: 'iterations',
message_sizes: 'message_sizes',
testRunResults: `${testSuites}/:testSuiteId`,
editExperiment: `${testSuites}/:testSuiteId`,
deleteExperiment: `${testSuites}/:testSuiteId`,
Expand All @@ -15,6 +16,7 @@ enum API_URLS {
analyze,
algorithms,
iterations,
message_sizes,
testRunResults,
editExperiment,
deleteExperiment,
Expand Down
5 changes: 5 additions & 0 deletions portal/src/app/components/all-experiments/Experiments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export const Experiments: React.FC = () => {
name: ALL_EXPERIMENTS_TABLE_EN.TABLE_COLUMNS.ITERATIONS.NAME,
accessor: (row: ExperimentData) => row.iterations?.join(', ')
},
{
id: ALL_EXPERIMENTS_TABLE_EN.TABLE_COLUMNS.MESSAGE_SIZES.ID,
name: ALL_EXPERIMENTS_TABLE_EN.TABLE_COLUMNS.MESSAGE_SIZES.NAME,
accessor: (row: ExperimentData) => row.message_sizes?.join(', ')
},
{
id: ALL_EXPERIMENTS_TABLE_EN.TABLE_COLUMNS.DATE.ID,
name: ALL_EXPERIMENTS_TABLE_EN.TABLE_COLUMNS.DATE.NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ describe('useExperimentsData', () => {
{
id: 366,
algorithm: "prime256v1",
iterations: 500
iterations: 500,
message_size: 1024
},
{
id: 367,
algorithm: "bikel3",
iterations: 1000
iterations: 1000,
message_size: 512
},
{
id: 368,
algorithm: "p256_kyber512",
iterations: 10000
iterations: 10000,
message_size: 1024
},
{
id: 369,
algorithm: "prime256v1",
iterations: 5000
iterations: 5000,
message_size: 512
}
]
},
Expand All @@ -47,12 +51,14 @@ describe('useExperimentsData', () => {
{
id: 370,
algorithm: "kyber512",
iterations: 500
iterations: 500,
message_size: 1024
},
{
id: 371,
algorithm: "kyber512",
iterations: 1000
iterations: 1000,
message_size: 2048
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ITestRunResult, ITestRunResultData } from '../../../shared/models/test-run-result.interface';

export type TestRunSubset = Pick<ITestRunResultData, 'id' | 'algorithm' | 'iterations'>;
export type TestRunSubset = Pick<ITestRunResultData, 'id' | 'algorithm' | 'iterations' | 'message_size'>;
export type Experiment = Pick<ITestRunResult, 'id' | 'name' | 'end_time'> & { test_runs: TestRunSubset[] };

export interface ExperimentData {
id: number;
name: string;
algorithms: string[];
iterations: number[];
message_sizes: number[];
end_time: number;
};
4 changes: 4 additions & 0 deletions portal/src/app/components/all-experiments/translate/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export const ALL_EXPERIMENTS_TABLE_EN = {
NAME: 'Iterations',
ID: 'iterations'
},
MESSAGE_SIZES: {
NAME: 'Message Size (KB)',
ID: 'message_size'
},
DATE: {
NAME: 'Date',
ID: 'date'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { parseExperimentsData } from './parse-experiments-data.utils';
import { ITestRunResultData } from '../../../shared/models/test-run-result.interface';
import { Experiment, ExperimentData } from '../models/experiments.interface';
import { Experiment, ExperimentData, TestRunSubset } from '../models/experiments.interface';

describe('parseExperimentsData', () => {
it('should parse experiments data correctly', () => {
Expand All @@ -9,8 +8,8 @@ describe('parseExperimentsData', () => {
id: 1,
name: 'Experiment 1',
test_runs: [
{ algorithm: 'Algorithm 1', iterations: 1000 } as ITestRunResultData,
{ algorithm: 'Algorithm 2', iterations: 5000 } as ITestRunResultData,
{ algorithm: 'Algorithm 1', iterations: 1000, message_size: 512 } as TestRunSubset,
{ algorithm: 'Algorithm 2', iterations: 5000, message_size: 1024 } as TestRunSubset,
],
end_time: 1705240065192,
},
Expand All @@ -22,6 +21,7 @@ describe('parseExperimentsData', () => {
name: 'Experiment 1',
algorithms: ['Algorithm 1', 'Algorithm 2'],
iterations: [1000, 5000],
message_sizes: [512, 1024],
end_time: 1705240065192,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ export function parseExperimentsData(test_suites: Experiment[]) {
test_suites.forEach((experiment: Experiment) => {
const algorithms = new Set<string>();
const iterations = new Set<number>();
const message_sizes = new Set<number>();
experiment.test_runs?.forEach((testRun: TestRunSubset) => {
algorithms.add(testRun.algorithm);
iterations.add(testRun.iterations);
message_sizes.add(testRun.message_size);
});

const sortedAlgorithms = Array.from(algorithms).sort();
const sortedIterations = Array.from(iterations).sort((a, b) => a - b);
const sortedMessageSizes = Array.from(message_sizes).sort((a, b) => a - b);

experimentsData.push({
id: experiment.id,
name: experiment.name,
algorithms: Array.from(algorithms),
iterations: Array.from(iterations),
algorithms: sortedAlgorithms,
iterations: sortedIterations,
message_sizes: sortedMessageSizes,
end_time: experiment.end_time
});
});
Expand Down
4 changes: 4 additions & 0 deletions portal/src/app/components/dashboard/Dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ describe('Dashboard', () => {
label: '1000',
value: '1000',
},
messageSizes: {
label: '1024',
value: '1024'
},
description: 'Sample description',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ describe('Charts', () => {
label: '1000',
value: '1000',
},
messageSizes: {
label: '1024',
value: '1024'
},
description: 'test'
};

Expand Down
1 change: 1 addition & 0 deletions portal/src/app/components/home/Home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Home', () => {
experimentName: 'test',
algorithms: { label: 'regular', value: 'regular' },
iterationsCount: { label: 'regular', value: 'regular' },
messageSizes: [{ label: '1024', value: '1024' }],
description: 'test'
});
}
Expand Down
Loading
Loading