Skip to content

Commit

Permalink
Merge branch 'release-2.03.0' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
edmc-ss committed Dec 7, 2022
2 parents ef4dec3 + b6a7b8a commit 064dff3
Show file tree
Hide file tree
Showing 42 changed files with 1,559 additions and 1,213 deletions.
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
# [-d|--detach] \
# [-it] \
# [--rm] \
# [--privileged] \
# [--cap-add SYS_ADMIN] \
# [--device /dev/fuse] \
# [--mount src="$(pwd)",target="/src",type=bind] \
# [--env DISPLAY=<hostOrIP>:<displayNumber>[.<screenNumber]] \
# <image id>|<repository>[:<tag>]
Expand All @@ -53,20 +54,23 @@
# -d|--detach: tells Docker to detach from running container
# -it: tells Docker to run container interactively
# --rm: tells Docker to destroy container upon exit
# --privileged:
# 1) tells Docker to, among other things, grant access to /dev/fuse
# --cap-add:
# 1) tells Docker to enable FUSE mounts
# 2) only useful for --target dev and --target iclient
# --device:
# 1) tells Docker to grant access to /dev/fuse
# 2) only useful for --target dev and --target iclient
# --mount:
# 1) bind mounts the context into /src in the container
# 2) /src will be a read-write'able equivalent to the context dir
# 3) only useful for --target dev
# --env DISPLAY: tells Docker to set ENV DISPLAY for X apps (e.g. wireshark)

FROM alpine:3.15.0 as base
FROM alpine:3.17 as base
RUN apk add --no-cache libc6-compat

FROM base as dev
ARG GolangVersion=1.18
ARG GolangVersion=1.19.4
RUN apk add --no-cache \
bind-tools \
curl \
Expand Down Expand Up @@ -94,6 +98,7 @@ RUN go build github.com/go-delve/delve/cmd/dlv
RUN cp dlv /usr/local/go/bin/.
VOLUME /src
WORKDIR /src
RUN git config --global --add safe.directory /src

FROM dev as build
ARG MakeTarget
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ To clear out prior deamon runs and run the daemons in the background:
* [`dev` /src#] rm -rf /tmp/ickptDB
* [`dev` /src#] ickpt/ickpt ickpt/dev.conf &
* [`dev` /src#] imgr/imgr imgr/dev.conf &
* [`dev` /src#] idestroy/idestroy iclient/dev.conf &
* [`dev` /src#] idestroy/idestroy iclient/dev.conf
* [`dev` /src#] imgr/mkmount.sh -fs
* [`dev` /src#] iclient/iclient iclient/dev.conf &

Expand Down
61 changes: 22 additions & 39 deletions bucketstats/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// placed in a structure and registered, with a name, via a call to Register()
// before being used. The set of the statistics registered can be queried using
// the registered name or individually.
//
package bucketstats

import (
Expand All @@ -31,7 +30,6 @@ const (
// values added.
//
// Adding a negative value is not supported.
//
type Totaler interface {
Increment()
Add(value uint64)
Expand All @@ -43,7 +41,6 @@ type Totaler interface {
//
// This adds a CountGet() function that returns the number of values added as
// well as an AverageGet() method that returns the average.
//
type Averager interface {
Totaler
CountGet() (count uint64)
Expand All @@ -57,11 +54,11 @@ type Averager interface {
// RangeHigh the largest value mapped to the bucket
// NominalVal the nominal value of the bucket (sqrt(2)^n or 2^n)
// MeanVal the mean value of values added to the bucket, assuming
// a uniform distribution
//
// a uniform distribution
//
// When performing math on these statistics be careful of overflowing a uint64.
// It may be a good idea to use the "math/big" package.
//
type BucketInfo struct {
Count uint64
NominalVal uint64
Expand All @@ -77,7 +74,6 @@ type BucketInfo struct {
//
// DistGet() returns the distribution of values across the buckets as an array
// of BucketInfo.
//
type Bucketer interface {
Averager
DistGet() []BucketInfo
Expand All @@ -93,7 +89,6 @@ type Bucketer interface {
// of stats. One or the other, but not both, can be the empty string.
// Whitespace characters, '"' (double quote), '*' (asterik), and ':' (colon) are
// not allowed in either name.
//
func Register(pkgName string, statsGroupName string, statsStruct interface{}) {
register(pkgName, statsGroupName, statsStruct)
}
Expand All @@ -102,7 +97,6 @@ func Register(pkgName string, statsGroupName string, statsStruct interface{}) {
//
// Once unregistered, the same or a different set of statistics can be
// registered using the same name.
//
func UnRegister(pkgName string, statsGroupName string) {
unRegister(pkgName, statsGroupName)
}
Expand All @@ -115,7 +109,6 @@ func UnRegister(pkgName string, statsGroupName string) {
//
// Use "*" to select all package names with a given group name, all
// groups with a given package name, or all groups.
//
func SprintStats(stringFmt StatStringFormat, pkgName string, statsGroupName string) (values string) {
return sprintStats(stringFmt, pkgName, statsGroupName)
}
Expand All @@ -124,7 +117,6 @@ func SprintStats(stringFmt StatStringFormat, pkgName string, statsGroupName stri
//
// Name must be unique within statistics in the structure. If it is "" then
// Register() will assign a name based on the name of the field.
//
type Total struct {
total uint64 // Ensure 64-bit alignment
Name string
Expand All @@ -143,7 +135,6 @@ func (this *Total) TotalGet() uint64 {
}

// Return a string with the statistic's value in the specified format.
//
func (this *Total) Sprint(stringFmt StatStringFormat, pkgName string, statsGroupName string) string {
return this.sprint(stringFmt, pkgName, statsGroupName)
}
Expand All @@ -153,22 +144,19 @@ func (this *Total) Sprint(stringFmt StatStringFormat, pkgName string, statsGroup
//
// Name must be unique within statistics in the structure. If it is "" then
// Register() will assign a name based on the name of the field.
//
type Average struct {
count uint64 // Ensure 64-bit alignment
total uint64 // Ensure 64-bit alignment
Name string
}

// Add a value to the mean statistics.
//
func (this *Average) Add(value uint64) {
atomicAddUint64(&this.total, value)
atomicAddUint64(&this.count, 1)
}

// Add a value of 1 to the mean statistics.
//
func (this *Average) Increment() {
this.Add(1)
}
Expand All @@ -186,7 +174,6 @@ func (this *Average) AverageGet() uint64 {
}

// Return a string with the statistic's value in the specified format.
//
func (this *Average) Sprint(stringFmt StatStringFormat, pkgName string, statsGroupName string) string {
return this.sprint(stringFmt, pkgName, statsGroupName)
}
Expand All @@ -206,18 +193,19 @@ func (this *Average) Sprint(stringFmt StatStringFormat, pkgName string, statsGro
//
// Example mappings of values to buckets:
//
// Values Bucket
// 0 0
// 1 1
// 2 2
// 3 - 5 3
// 6 - 11 4
// Values Bucket
// 0 0
// 1 1
// 2 2
// 3 - 5 3
// 6 - 11 4
//
// 12 - 22 5
// etc.
//
// etc.
//
// Note that value 2^n increments the count in bucket n + 1, but the average of
// values in bucket n is very slightly larger than 2^n.
//
type BucketLog2Round struct {
Name string
NBucket uint
Expand All @@ -243,7 +231,6 @@ func (this *BucketLog2Round) Add(value uint64) {
}

// Add a value of 1 to the bucketized statistics.
//
func (this *BucketLog2Round) Increment() {
this.Add(1)
}
Expand All @@ -264,13 +251,11 @@ func (this *BucketLog2Round) AverageGet() uint64 {
}

// Return BucketInfo information for all the buckets.
//
func (this *BucketLog2Round) DistGet() []BucketInfo {
return bucketDistMake(this.NBucket, this.statBuckets[:], log2RoundBucketTable[:])
}

// Return a string with the statistic's value in the specified format.
//
func (this *BucketLog2Round) Sprint(stringFmt StatStringFormat, pkgName string, statsGroupName string) string {
return bucketSprint(stringFmt, pkgName, statsGroupName, this.Name, this.DistGet())
}
Expand All @@ -293,20 +278,21 @@ func (this *BucketLog2Round) Sprint(stringFmt StatStringFormat, pkgName string,
//
// Example mappings of values to buckets:
//
// Values Bucket
// 0 0
// 1 1
// 2 2
// 3 3
// 4 4
// 5 - 6 5
// 7 - 9 6
// Values Bucket
// 0 0
// 1 1
// 2 2
// 3 3
// 4 4
// 5 - 6 5
// 7 - 9 6
//
// 10 - 13 7
// etc.
//
// etc.
//
// Note that a value sqrt(2)^n increments the count in bucket 2 * n, but the
// average of values in bucket n is slightly larger than sqrt(2)^n.
//
type BucketLogRoot2Round struct {
Name string
NBucket uint
Expand All @@ -332,7 +318,6 @@ func (this *BucketLogRoot2Round) Add(value uint64) {
}

// Add a value of 1 to the bucketized statistics.
//
func (this *BucketLogRoot2Round) Increment() {
this.Add(1)
}
Expand All @@ -353,13 +338,11 @@ func (this *BucketLogRoot2Round) AverageGet() uint64 {
}

// Return BucketInfo information for all the buckets.
//
func (this *BucketLogRoot2Round) DistGet() []BucketInfo {
return bucketDistMake(this.NBucket, this.statBuckets[:], logRoot2RoundBucketTable[:])
}

// Return a string with the statistic's value in the specified format.
//
func (this *BucketLogRoot2Round) Sprint(stringFmt StatStringFormat, pkgName string, statsGroupName string) string {
return bucketSprint(stringFmt, pkgName, statsGroupName, this.Name, this.DistGet())
}
2 changes: 0 additions & 2 deletions bucketstats/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ func TestTotaler(t *testing.T) {
}

// Test Bucketer specific functionality (which is mostly buckets)
//
func TestBucketer(t *testing.T) {

var (
Expand Down Expand Up @@ -553,7 +552,6 @@ func TestSprintStats(t *testing.T) {
//
// If panic() is called with a nil argument then this function also returns the
// empty string.
//
func catchAPanic(aFunc func()) (panicStr string) {

defer func() {
Expand Down
15 changes: 3 additions & 12 deletions bucketstats/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var (

// Register a set of statistics, where the statistics are one or more fields in
// the passed structure.
//
func register(pkgName string, statsGroupName string, statsStruct interface{}) {

var ok bool
Expand Down Expand Up @@ -157,7 +156,6 @@ func unRegister(pkgName string, statsGroupName string) {
}

// Return the selected group(s) of statistics as a string.
//
func sprintStats(statFmt StatStringFormat, pkgName string, statsGroupName string) (statValues string) {

statsNameMapLock.Lock()
Expand Down Expand Up @@ -246,7 +244,6 @@ func sprintStatsStruct(statFmt StatStringFormat, pkgName string, statsGroupName
}

// Construct and return a statistics name (fully qualified field name) in the specified format.
//
func statisticName(statFmt StatStringFormat, pkgName string, statsGroupName string, fieldName string) string {

switch statFmt {
Expand All @@ -273,7 +270,6 @@ func statisticName(statFmt StatStringFormat, pkgName string, statsGroupName stri
}

// Return the "name" of the bucket that would hold 'n' as the string "2^x".
//
func bucketNameLog2(value uint64) string {

var idx uint
Expand All @@ -289,7 +285,6 @@ func bucketNameLog2(value uint64) string {

// Return the "name" of the bucket that would hold 'n' as the string "2^x",
// where x can have the suffix ".5" as in "2^7.5".
//
func bucketNameLogRoot2(value uint64) string {

var idx uint
Expand All @@ -307,7 +302,6 @@ func bucketNameLogRoot2(value uint64) string {
}

// Return a string with the statistic's value in the specified format.
//
func (this *Total) sprint(statFmt StatStringFormat, pkgName string, statsGroupName string) string {

statName := statisticName(statFmt, pkgName, statsGroupName, this.Name)
Expand All @@ -321,7 +315,6 @@ func (this *Total) sprint(statFmt StatStringFormat, pkgName string, statsGroupNa
}

// Return a string with the statistic's value in the specified format.
//
func (this *Average) sprint(statFmt StatStringFormat, pkgName string, statsGroupName string) string {

statName := statisticName(statFmt, pkgName, statsGroupName, this.Name)
Expand All @@ -341,7 +334,6 @@ func (this *Average) sprint(statFmt StatStringFormat, pkgName string, statsGroup

// The canonical distribution for a bucketized statistic is an array of BucketInfo.
// Create one based on the information for this bucketstat .
//
func bucketDistMake(nBucket uint, statBuckets []uint32, bucketInfoBase []BucketInfo) []BucketInfo {

// copy the base []BucketInfo before modifying it
Expand Down Expand Up @@ -371,11 +363,12 @@ func bucketDistMake(nBucket uint, statBuckets []uint32, bucketInfoBase []BucketI
//
// o the index of the first entry with a non-zero count
// o the index + 1 of the last entry with a non-zero count, or zero if no such
// bucket exists
//
// bucket exists
//
// o the count (number things in buckets)
// o sum of counts * count_meanVal, and
// o mean (average)
//
func bucketCalcStat(bucketInfo []BucketInfo) (firstIdx int, maxIdx int, count uint64, sum uint64, mean uint64) {

var (
Expand Down Expand Up @@ -421,7 +414,6 @@ func bucketCalcStat(bucketInfo []BucketInfo) (firstIdx int, maxIdx int, count ui
}

// Return a string with the bucketized statistic content in the specified format.
//
func bucketSprint(statFmt StatStringFormat, pkgName string, statsGroupName string, fieldName string,
bucketInfo []BucketInfo) string {

Expand Down Expand Up @@ -459,7 +451,6 @@ func bucketSprint(statFmt StatStringFormat, pkgName string, statsGroupName strin
}

// Replace illegal characters in names with underbar (`_`)
//
func scrubName(name string) string {

// Names should include only pritable characters that are not
Expand Down
Loading

0 comments on commit 064dff3

Please sign in to comment.