Skip to content

Commit 76fa68a

Browse files
committed
fix: properly name native functions
1 parent e976b0a commit 76fa68a

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

packages/benchmark.js/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ function withCodSpeedBenchmark(bench: Benchmark): Benchmark {
2222
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2323
bench.run = function (options?: Benchmark.Options): Benchmark {
2424
const uri = callingFile + "::" + (bench.name ?? "unknown");
25-
measurement.startMeasurement();
25+
measurement.startInstrumentation();
2626
(bench.fn as CallableFunction)();
27-
measurement.stopMeasurement(uri);
27+
measurement.stopInstrumentation(uri);
2828
return bench;
2929
};
3030
return bench;
@@ -46,9 +46,9 @@ function withCodSpeedSuite(suite: Benchmark.Suite): Benchmark.Suite {
4646
for (let i = 0; i < benches.length; i++) {
4747
const bench = benches[i];
4848
const uri = baseUri + "::" + (bench.name ?? `unknown_${i}`);
49-
measurement.startMeasurement();
49+
measurement.startInstrumentation();
5050
(bench.fn as CallableFunction)();
51-
measurement.stopMeasurement(uri);
51+
measurement.stopInstrumentation(uri);
5252
}
5353
return suite;
5454
};

packages/benchmark.js/tests/unit.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ describe("Benchmark", () => {
2626
maxTime: -Infinity,
2727
});
2828
expect(onComplete).toHaveBeenCalled();
29-
expect(mockCore.startMeasurement).not.toHaveBeenCalled();
30-
expect(mockCore.stopMeasurement).not.toHaveBeenCalled();
29+
expect(mockCore.startInstrumentation).not.toHaveBeenCalled();
30+
expect(mockCore.stopInstrumentation).not.toHaveBeenCalled();
3131
});
3232
it("check core methods are called", () => {
3333
mockCore.isInstrumented.mockReturnValue(true);
@@ -37,8 +37,8 @@ describe("Benchmark", () => {
3737
/o/.test("Hello World!");
3838
})
3939
).run();
40-
expect(mockCore.startMeasurement).toHaveBeenCalled();
41-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
40+
expect(mockCore.startInstrumentation).toHaveBeenCalled();
41+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
4242
"packages/benchmark.js/tests/unit.test.ts::RegExpSingle"
4343
);
4444
});
@@ -55,8 +55,8 @@ describe("Benchmark.Suite", () => {
5555
suite.on("complete", onComplete);
5656
suite.run({ maxTime: 0.1, initCount: 1 });
5757
expect(onComplete).toHaveBeenCalled();
58-
expect(mockCore.startMeasurement).not.toHaveBeenCalled();
59-
expect(mockCore.stopMeasurement).not.toHaveBeenCalled();
58+
expect(mockCore.startInstrumentation).not.toHaveBeenCalled();
59+
expect(mockCore.stopInstrumentation).not.toHaveBeenCalled();
6060
});
6161
it("check core methods are called", () => {
6262
mockCore.isInstrumented.mockReturnValue(true);
@@ -65,8 +65,8 @@ describe("Benchmark.Suite", () => {
6565
/o/.test("Hello World!");
6666
})
6767
.run();
68-
expect(mockCore.startMeasurement).toHaveBeenCalled();
69-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
68+
expect(mockCore.startInstrumentation).toHaveBeenCalled();
69+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
7070
"packages/benchmark.js/tests/unit.test.ts::RegExp"
7171
);
7272
});
@@ -80,10 +80,10 @@ describe("Benchmark.Suite", () => {
8080
/o/.test("Hello World!");
8181
})
8282
.run();
83-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
83+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
8484
"packages/benchmark.js/tests/unit.test.ts::thesuite::RegExp"
8585
);
86-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
86+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
8787
"packages/benchmark.js/tests/unit.test.ts::thesuite::unknown_1"
8888
);
8989
});

packages/core/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import path from "path";
33
/* eslint-disable @typescript-eslint/no-empty-function */
44
export interface Measurement {
55
isInstrumented(): boolean;
6-
startMeasurement(): void;
7-
stopMeasurement(at: string): void;
6+
startInstrumentation(): void;
7+
stopInstrumentation(at: string): void;
88
isBound: boolean;
99
}
1010

@@ -20,9 +20,9 @@ try {
2020
console.warn("@codspeed/core binding not available on this architecture");
2121
m = {
2222
isInstrumented: () => false,
23-
startMeasurement: () => {},
23+
startInstrumentation: () => {},
2424
// eslint-disable-next-line @typescript-eslint/no-unused-vars
25-
stopMeasurement: (at) => {},
25+
stopInstrumentation: (at) => {},
2626
isBound: false,
2727
};
2828
}

packages/tinybench/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export function withCodSpeed(bench: Bench): Bench {
1212
bench.run = async () => {
1313
for (const task of bench.tasks) {
1414
const uri = callingFile + "::" + task.name;
15-
measurement.startMeasurement();
15+
measurement.startInstrumentation();
1616
await task.fn();
17-
measurement.stopMeasurement(uri);
17+
measurement.stopInstrumentation(uri);
1818
}
1919
return bench.tasks;
2020
};

packages/tinybench/tests/unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ describe("Benchmark.Suite", () => {
2323
await bench.run();
2424

2525
expect(onComplete).toHaveBeenCalled();
26-
expect(mockCore.startMeasurement).not.toHaveBeenCalled();
27-
expect(mockCore.stopMeasurement).not.toHaveBeenCalled();
26+
expect(mockCore.startInstrumentation).not.toHaveBeenCalled();
27+
expect(mockCore.stopInstrumentation).not.toHaveBeenCalled();
2828
});
2929
it("check core methods are called", async () => {
3030
mockCore.isInstrumented.mockReturnValue(true);
@@ -33,8 +33,8 @@ describe("Benchmark.Suite", () => {
3333
/o/.test("Hello World!");
3434
})
3535
.run();
36-
expect(mockCore.startMeasurement).toHaveBeenCalled();
37-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
36+
expect(mockCore.startInstrumentation).toHaveBeenCalled();
37+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
3838
"packages/tinybench/tests/unit.test.ts::RegExp"
3939
);
4040
});
@@ -48,10 +48,10 @@ describe("Benchmark.Suite", () => {
4848
/o/.test("Hello World!");
4949
})
5050
.run();
51-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
51+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
5252
"packages/tinybench/tests/unit.test.ts::RegExp"
5353
);
54-
expect(mockCore.stopMeasurement).toHaveBeenCalledWith(
54+
expect(mockCore.stopInstrumentation).toHaveBeenCalledWith(
5555
"packages/tinybench/tests/unit.test.ts::RegExp2"
5656
);
5757
});

0 commit comments

Comments
 (0)