Skip to content
Open
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
8 changes: 8 additions & 0 deletions change/p-profiler-2020-10-16-19-00-08-optional-out-file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "feat: Add option to set output filename",
"packageName": "p-profiler",
"email": "olwheele@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-10-16T17:00:08.686Z"
}
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface ProfilerOptions {
concurrency: number;
prefix: string;
outDir: string;
outFileName?: string;
}

export default class Profiler {
Expand All @@ -33,12 +34,12 @@ export default class Profiler {
private threads: number[];

constructor(opts: ProfilerOptions) {
const { concurrency, outDir, prefix } = opts;
const { concurrency, outDir, prefix, outFileName } = opts;

this.events = [];
this.outputPath = path.join(
path.resolve(outDir || "."),
getTimeBasedFilename(prefix)
outFileName ?? getTimeBasedFilename(prefix)
);
this.threads = range(concurrency);
}
Expand Down