support custom output paths
This commit is contained in:
Родитель
f60d98363e
Коммит
f693c73979
10
src/index.ts
10
src/index.ts
|
@ -25,6 +25,7 @@ export interface ProfilerOptions {
|
|||
concurrency: number;
|
||||
prefix: string;
|
||||
outDir: string;
|
||||
customOutputPath: string;
|
||||
}
|
||||
|
||||
export default class Profiler {
|
||||
|
@ -33,13 +34,12 @@ export default class Profiler {
|
|||
private threads: number[];
|
||||
|
||||
constructor(opts: ProfilerOptions) {
|
||||
const { concurrency, outDir, prefix } = opts;
|
||||
const { concurrency, outDir, prefix, customOutputPath } = opts;
|
||||
|
||||
this.events = [];
|
||||
this.outputPath = path.join(
|
||||
path.resolve(outDir || "."),
|
||||
getTimeBasedFilename(prefix)
|
||||
);
|
||||
this.outputPath =
|
||||
customOutputPath ||
|
||||
path.join(path.resolve(outDir || "."), getTimeBasedFilename(prefix));
|
||||
this.threads = range(concurrency);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче