This change moves maxArgs to tracev2 and renames it MaxTimedEventArgs.
It also updates the tests to make sure the specs conform to this
requirement.
Change-Id: I7b0c888a4dfd83306a470a4c9b0f9e44fe2e7818
Reviewed-on: https://go-review.googlesource.com/c/go/+/646016
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
"internal/trace/version"
)
-// maxArgs is the maximum number of arguments for "plain" events,
-// i.e. anything that could reasonably be represented as a baseEvent.
-const maxArgs = 5
-
// timedEventArgs is an array that is able to hold the arguments for any
// timed event.
-type timedEventArgs [maxArgs - 1]uint64
+type timedEventArgs [tracev2.MaxTimedEventArgs - 1]uint64
// baseEvent is the basic unprocessed event. This serves as a common
// fundamental data structure across.
const NumExperimentalEvents = MaxExperimentalEvent - MaxEvent
+// MaxTimedEventArgs is the maximum number of arguments for timed events.
+const MaxTimedEventArgs = 5
+
func Specs() []EventSpec {
return specs[:]
}
if spec.IsStack && spec.Name != "Stack" {
t.Errorf("%s listed as being a stack, but is not the Stack event (unsupported)", spec.Name)
}
+ if spec.IsTimedEvent && len(spec.Args) > tracev2.MaxTimedEventArgs {
+ t.Errorf("%s has too many timed event args: have %d, want %d at most", spec.Name, len(spec.Args), tracev2.MaxTimedEventArgs)
+ }
if ev.Experimental() && spec.Experiment == tracev2.NoExperiment {
t.Errorf("experimental event %s must have an experiment", spec.Name)
}