forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
op-challenger: Use a wrapper to specify the vm type for metrics (ethe…
…reum-optimism#12020) * op-challenger: Use a wrapper to specify the vm type for metrics Decouples the vm type from the trace type to give the run-trace subcommand more flexibility, allowing it to report separate metrics for cannon and mt-cannon. Also adjust the run-trace loggers to consistently use `mt-cannon` as the type. * Use constant. Co-authored-by: Inphi <[email protected]> --------- Co-authored-by: Inphi <[email protected]>
- Loading branch information
Showing
10 changed files
with
65 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package metrics | ||
|
||
import "time" | ||
|
||
type VmMetricer interface { | ||
RecordVmExecutionTime(vmType string, t time.Duration) | ||
RecordVmMemoryUsed(vmType string, memoryUsed uint64) | ||
} | ||
|
||
type VmMetrics struct { | ||
m VmMetricer | ||
vmType string | ||
} | ||
|
||
func NewVmMetrics(m VmMetricer, vmType string) *VmMetrics { | ||
return &VmMetrics{ | ||
m: m, | ||
vmType: vmType, | ||
} | ||
} | ||
|
||
func (m *VmMetrics) RecordExecutionTime(dur time.Duration) { | ||
m.m.RecordVmExecutionTime(m.vmType, dur) | ||
} | ||
|
||
func (m *VmMetrics) RecordMemoryUsed(memoryUsed uint64) { | ||
m.m.RecordVmMemoryUsed(m.vmType, memoryUsed) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters