feat: added optional profiling

This commit is contained in:
2025-12-28 22:52:10 -05:00
parent a4c049c0ff
commit e9dc3fe171
8 changed files with 124 additions and 77 deletions

View File

@@ -2,10 +2,8 @@ package config
// Arguments given to program.
type Config struct {
// The source code given to the program.
Source Source
// Whether or not to print debug logs.
Verbose bool
// Whether or not to print an explanation of the reduction.
Explanation bool
Source Source // The source code given to the program.
Verbose bool // Whether or not to print debug logs.
Explanation bool // Whether or not to print an explanation of the reduction.
Profile string // If not nil, print a CPU profile during execution.
}

View File

@@ -10,6 +10,7 @@ func FromArgs() (*Config, error) {
// Parse flags.
verbose := flag.Bool("v", false, "Verbosity. If set, the program will print logs.")
explanation := flag.Bool("x", false, "Explanation. Whether or not to show all reduction steps.")
profile := flag.String("p", "", "CPU profiling. If set, the program will run a performance profile during execution.")
flag.Parse()
// Parse non-flag arguments.
@@ -31,5 +32,6 @@ func FromArgs() (*Config, error) {
Source: source,
Verbose: *verbose,
Explanation: *explanation,
Profile: *profile,
}, nil
}