From 8e8b99229438d74b7f868a5442a8f363a10a5815 Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Fri, 13 Jun 2014 00:46:16 +0100 Subject: [PATCH] Fixed typos --- container/samplermngr.go | 6 +++--- container/statssum.go | 2 +- container/statssum_test.go | 2 +- info/container.go | 4 ++-- sampling/autoreset.go | 2 +- sampling/chainsample.go | 2 +- sampling/reservoir.go | 2 +- sampling/sampler.go | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/container/samplermngr.go b/container/samplermngr.go index a290036c..0565cf22 100644 --- a/container/samplermngr.go +++ b/container/samplermngr.go @@ -54,7 +54,7 @@ func (self *reservoirSamplerFactory) String() string { func (self *reservoirSamplerFactory) NewSampler(param *StatsParameter) (sampling.Sampler, error) { s := sampling.NewReservoirSampler(param.NumSamples) if param.ResetPeriod.Seconds() > 1.0 { - s = sampling.NewPeriodcallyResetSampler(param.ResetPeriod, s) + s = sampling.NewPeriodicallyResetSampler(param.ResetPeriod, s) } return s, nil } @@ -74,7 +74,7 @@ func (self *esSamplerFactory) NewSampler(param *StatsParameter) (sampling.Sample return delta.Seconds() }) if param.ResetPeriod.Seconds() > 1.0 { - s = sampling.NewPeriodcallyResetSampler(param.ResetPeriod, s) + s = sampling.NewPeriodicallyResetSampler(param.ResetPeriod, s) } return s, nil } @@ -89,7 +89,7 @@ func (self *chainSamplerFactory) String() string { func (self *chainSamplerFactory) NewSampler(param *StatsParameter) (sampling.Sampler, error) { s := sampling.NewChainSampler(param.NumSamples, param.WindowSize) if param.ResetPeriod.Seconds() > 1.0 { - s = sampling.NewPeriodcallyResetSampler(param.ResetPeriod, s) + s = sampling.NewPeriodicallyResetSampler(param.ResetPeriod, s) } return s, nil } diff --git a/container/statssum.go b/container/statssum.go index faa3c67d..081e6667 100644 --- a/container/statssum.go +++ b/container/statssum.go @@ -115,7 +115,7 @@ func (self *percentilesContainerHandlerWrapper) StatsSummary() (*info.ContainerS samples = append(samples, stats) }) self.containerPercentiles.Samples = samples - // XXX(dengnan): propabily add to StatsParameter? + // XXX(dengnan): probably add to StatsParameter? self.containerPercentiles.FillPercentiles( []int{50, 80, 90, 95, 99}, []int{50, 80, 90, 95, 99}, diff --git a/container/statssum_test.go b/container/statssum_test.go index 7385bd2b..0c020e12 100644 --- a/container/statssum_test.go +++ b/container/statssum_test.go @@ -150,7 +150,7 @@ func TestSampleCpuUsage(t *testing.T) { t.Error(err) } - // request stats/obervation N+1 times, so that there will be N samples + // request stats/observation N+1 times, so that there will be N samples for i := 0; i < N+1; i++ { _, err = handler.GetStats() if err != nil { diff --git a/info/container.go b/info/container.go index 6fd67b46..fe9245b0 100644 --- a/info/container.go +++ b/info/container.go @@ -135,7 +135,7 @@ type MemoryStats struct { Usage uint64 `json:"usage,omitempty"` // The amount of working set memory, this includes recently accessed memory, - // dirty memory, and kernel memmory. Working set is <= "usage". + // dirty memory, and kernel memory. Working set is <= "usage". // Units: Bytes. WorkingSet uint64 `json:"working_set,omitempty"` @@ -206,7 +206,7 @@ func NewSample(prev, current *ContainerStats) (*ContainerStatsSample, error) { return nil, fmt.Errorf("current CPU usage is less than prev CPU usage (cumulative).") } sample := new(ContainerStatsSample) - // Caculate the diff to get the CPU usage within the time interval. + // Calculate the diff to get the CPU usage within the time interval. sample.Cpu.Usage = current.Cpu.Usage.Total - prev.Cpu.Usage.Total // Memory usage is current memory usage sample.Memory.Usage = current.Memory.Usage diff --git a/sampling/autoreset.go b/sampling/autoreset.go index 0b7da0ca..b466e5e6 100644 --- a/sampling/autoreset.go +++ b/sampling/autoreset.go @@ -44,7 +44,7 @@ func (self *autoResetSampler) Update(d interface{}) { self.sampler.Update(d) } -func NewPeriodcallyResetSampler(period time.Duration, sampler Sampler) Sampler { +func NewPeriodicallyResetSampler(period time.Duration, sampler Sampler) Sampler { lastRest := time.Now() shouldReset := func(d interface{}) bool { if time.Now().Sub(lastRest) > period { diff --git a/sampling/chainsample.go b/sampling/chainsample.go index 8154e2e5..bee64e82 100644 --- a/sampling/chainsample.go +++ b/sampling/chainsample.go @@ -21,7 +21,7 @@ func randInt64Except(start, end int64, except map[int64]empty) int64 { } // Basic idea: -// Every obervation will have a sequence number as its id. +// Every observation will have a sequence number as its id. // Suppose we want to sample k observations within latest n observations // At first, we generated k random numbers in [0,n). These random numbers // will be used as ids of observations that will be sampled. diff --git a/sampling/reservoir.go b/sampling/reservoir.go index fc76e103..a0276360 100644 --- a/sampling/reservoir.go +++ b/sampling/reservoir.go @@ -51,7 +51,7 @@ func (self *reservoirSampler) Update(d interface{}) { self.samples = append(self.samples, d) return } - // Randomly generates a number between [0, numInances). + // Randomly generates a number between [0, numInstances). // Use this random number, j, as an index. If j is larger than the // reservoir size, we will ignore the current new data. // Otherwise replace the jth element in reservoir with the new data. diff --git a/sampling/sampler.go b/sampling/sampler.go index 4e81ac55..549f6e9e 100644 --- a/sampling/sampler.go +++ b/sampling/sampler.go @@ -36,7 +36,7 @@ type Sampler interface { // Filter() should update in place. Removing elements may or may not // affect the statistical behavior of the sampler, i.e. the probability - // that an obervation will be sampled after removing some elements is + // that an observation will be sampled after removing some elements is // implementation defined. Filter(filter func(interface{}) bool) }