From b261c2a4f5f028c9d83cef208ccc7d829f841bad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 31 Dec 2022 11:59:09 -0700 Subject: tree-wide: Annotate values that I might want to be tuning --- lib/textui/log_memstats.go | 2 +- lib/textui/tunable.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 lib/textui/tunable.go (limited to 'lib/textui') diff --git a/lib/textui/log_memstats.go b/lib/textui/log_memstats.go index 39733c6..6e3c3a1 100644 --- a/lib/textui/log_memstats.go +++ b/lib/textui/log_memstats.go @@ -19,7 +19,7 @@ type LiveMemUse struct { var _ fmt.Stringer = (*LiveMemUse)(nil) -const liveMemUseUpdateInterval = 1 * time.Second +var liveMemUseUpdateInterval = Tunable(1 * time.Second) func (o *LiveMemUse) String() string { o.mu.Lock() diff --git a/lib/textui/tunable.go b/lib/textui/tunable.go new file mode 100644 index 0000000..7e5f311 --- /dev/null +++ b/lib/textui/tunable.go @@ -0,0 +1,13 @@ +// Copyright (C) 2022 Luke Shumaker +// +// SPDX-License-Identifier: GPL-2.0-or-later + +package textui + +// Tunable annotates a value as something that might want to be tuned +// as the program gets optimized. +// +// TODO(lukeshu): Have Tunable be runtime-configurable. +func Tunable[T any](x T) T { + return x +} -- cgit v1.2.3-54-g00ecf