Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
TEST: Added Berlin ZoomIn test and add save result option
Browse files Browse the repository at this point in the history
  • Loading branch information
Nino Kettlitz authored and Nino Kettlitz committed Feb 19, 2020
1 parent a6201a4 commit 044c2b6
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 5 deletions.
26 changes: 25 additions & 1 deletion @here/harp-examples/lib/PerformanceConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,31 @@ export namespace PerformanceTestData {
tilts: [0, 0, 0, 0, 0, 0],
numberOfDrawPoints: 250
};

export const BERLIN_ZOOM_IN = {
controlPoints: [
52.5,
13.4,
52.5,
13.4,
52.5,
13.4,
52.5,
13.4,
52.5,
13.4,
52.5,
13.4,
52.5,
13.4,
52.5,
13.4,
52.5,
13.4
],
zoomLevels: [12, 13, 14, 15, 16, 17, 18, 19, 20],
tilts: [0, 0, 0, 0, 0, 0, 0, 0, 0],
numberOfDrawPoints: 250
};
export const PARIS_ZOOM_IN_AND_OUT_2 = {
controlPoints: [
48.8566,
Expand Down
2 changes: 1 addition & 1 deletion @here/harp-examples/lib/PerformanceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export namespace PerformanceUtils {
];

const DEFAULT_THEME = {
resource: "resources/berlin_tilezen_base.json"
resource: "resources/normal.day.json"
};

function getVendorFomContext(context: WebGLRenderingContext): GlInfo {
Expand Down
61 changes: 58 additions & 3 deletions @here/harp-examples/src/performance_benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getDecoderCount(str: string): number | undefined {
if (numDecodersParam < -1 || numDecodersParam > 32) {
logger.log(
`Illegal value for 'Num Decoders' ${numDecodersParam}. ` +
"Setting default value for DecoderCount"
"Setting default value for DecoderCount"
);
return undefined;
}
Expand Down Expand Up @@ -549,6 +549,22 @@ export namespace PerformanceBenchmark {
finishTest();
}

async function ZoomInBerlin() {
startTest("ZoomIn", "Berlin");
latestResult = await PerformanceUtils.measureFlyoverSpline(
mapViewApp,
"ZoomIn_Berlin",
PerformanceTestData.BERLIN_ZOOM_IN,
flyoverNumFrames,
false,
true,
showLabels,
flyoverNumRuns,
checkIfCancelled
);
finishTest();
}

async function ZoomInOutParis() {
startTest("ZoomInOut", "Paris");
latestResult = await PerformanceUtils.measureFlyoverSpline(
Expand Down Expand Up @@ -591,7 +607,8 @@ export namespace PerformanceBenchmark {
reducedDay: "resources/berlin_tilezen_day_reduced.json",
reducedNight: "resources/berlin_tilezen_night_reduced.json",
streets: "resources/berlin_tilezen_effects_streets.json",
outlines: "resources/berlin_tilezen_effects_outlines.json"
outlines: "resources/berlin_tilezen_effects_outlines.json",
miami: "resources/normal.day.json"
},
PixelRatio: {
default: undefined,
Expand All @@ -601,6 +618,7 @@ export namespace PerformanceBenchmark {
},
CanvasSize: {
default: undefined,
"1100×900": "1100×900",
"640×400": "640×400",
"1024×768": "1024×768",
"1024×1024": "1024×1024",
Expand Down Expand Up @@ -660,7 +678,7 @@ export namespace PerformanceBenchmark {
"6": 6,
"8": 8
},
PhasedLoading: true,
PhasedLoading: false,
Berlin: () => {
openMapBerlin();
},
Expand Down Expand Up @@ -712,6 +730,9 @@ export namespace PerformanceBenchmark {
FlyOverEuropeLoaded: () => {
flyoverEuropeLoaded();
},
ZoomInBerlin: () => {
ZoomInBerlin();
},
ZoomInOutParis: () => {
ZoomInOutParis();
},
Expand All @@ -723,6 +744,9 @@ export namespace PerformanceBenchmark {
},
HideResults: () => {
hideTable();
},
SaveResults: () => {
saveTable()
}
};

Expand Down Expand Up @@ -863,6 +887,7 @@ export namespace PerformanceBenchmark {
})
.setValue(undefined);

flyOversFolder.add(guiOptions, "ZoomInBerlin");
flyOversFolder.add(guiOptions, "ZoomInOutParis");
flyOversFolder.add(guiOptions, "ZoomInOutParis2");
flyOversFolder.add(guiOptions, "FlyOverNY");
Expand All @@ -882,6 +907,7 @@ export namespace PerformanceBenchmark {
cancelButton = gui.add(guiOptions, "Cancel");

gui.add(guiOptions, "HideResults");
gui.add(guiOptions, "SaveResults");

(cancelButton as any).domElement.setAttribute("disabled", "");

Expand Down Expand Up @@ -917,6 +943,35 @@ export namespace PerformanceBenchmark {
tableDiv.style.display = "none";
}

function saveTable() {
const stats = latestResult;

let resultCSV =
"Name, Avg, Min, Max, Median, Med 75, Med 90, Med 95, Med 97, Med 99, Med 999\n";

const frameStatsStrings = Array.from(stats.frameStats!.keys()).sort();
for (const stat of frameStatsStrings) {
const frameStat = stats.frameStats!.get(stat)!;

const row =
`${stat}, ${valueString(frameStat.avg)}, ${valueString(frameStat.min)}, ${valueString(frameStat.max)}, ${valueString(frameStat.median)}, ${valueString(frameStat.median75)}, ${valueString(frameStat.median90)}, ${valueString(frameStat.median95)}, ${valueString(frameStat.median97)}, ${valueString(frameStat.median99)}, ${valueString(frameStat.median999)}\n`;
resultCSV += row;
}
const type = "text/csv";
const blob = new Blob([resultCSV], { type });
const a = document.createElement("a");
const url = URL.createObjectURL(blob);
a.download = `results.csv`;
a.href = url;
a.dispatchEvent(
new MouseEvent(`click`, {
bubbles: true,
cancelable: true,
view: window
})
);
}

const million = 1024 * 1024;
const digits = 2;

Expand Down

0 comments on commit 044c2b6

Please sign in to comment.