當前位置: 首頁>>代碼示例>>Golang>>正文


Golang gcstats.GcStats類代碼示例

本文整理匯總了Golang中github.com/aclements/go-gcstats/gcstats.GcStats的典型用法代碼示例。如果您正苦於以下問題:Golang GcStats類的具體用法?Golang GcStats怎麽用?Golang GcStats使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了GcStats類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: requireProgTimes

func requireProgTimes(s *gcstats.GcStats) {
	if !s.HaveProgTimes() {
		fmt.Fprintln(os.Stderr,
			"This analysis requires program execution times, which are missing from\n"+
				"this GC trace. Please see 'go doc gcstats' for how to enable these.")
		os.Exit(1)
	}
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:8,代碼來源:main.go

示例2: doMMU

func doMMU(s *gcstats.GcStats) {
	// 1e9 ns = 1000 ms
	windows := vec.Logspace(-3, 0, samples, 10)
	plot := newPlot("granularity", windows, "--style", "mmu")
	plot.addSeries("MMU", func(window float64) float64 {
		return s.MMU(int(window * 1e9))
	})
	showPlot(plot)
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:9,代碼來源:main.go

示例3: doStopCDF

func doStopCDF(s *gcstats.GcStats, kdes map[gcstats.PhaseKind]*stats.KDE) {
	xs := jointAxis(kdes, float64(s.MaxPause())/1e9)

	for _, kde := range kdes {
		kde.Kernel = stats.DeltaKernel
	}

	plot := newPlot("pause time", xs)
	for kind := gcstats.PhaseSweepTerm; kind <= gcstats.PhaseMultiple; kind++ {
		if kde := kdes[kind]; kde != nil {
			plot.addSeries(kind.String(), kde.CDF)
		}
	}
	showPlot(plot)
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:15,代碼來源:main.go

示例4: stopKDEs

func stopKDEs(s *gcstats.GcStats) map[gcstats.PhaseKind]*stats.KDE {
	stops := s.Stops()
	times := make(map[gcstats.PhaseKind]stats.Sample)
	for _, stop := range stops {
		s := times[stop.Kind]
		s.Xs = append(s.Xs, float64(stop.Duration)/1e9)
		times[stop.Kind] = s
	}

	kdes := make(map[gcstats.PhaseKind]*stats.KDE)
	for kind, sample := range times {
		// XXX Bandwidth
		kdes[kind] = &stats.KDE{
			Sample: sample,
			//Bandwidth:      stats.FixedBandwidth(100000),
			BoundaryMethod: stats.BoundaryReflect,
			BoundaryMax:    math.Inf(1),
		}
	}
	return kdes
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:21,代碼來源:main.go

示例5: doMUDMap

func doMUDMap(s *gcstats.GcStats) {
	windows := ints(vec.Logspace(6, 9, 100, 10))
	muds := make([]*gcstats.MUD, len(windows))
	for i, windowNS := range windows {
		muds[i] = s.MutatorUtilizationDistribution(windowNS)
	}
	// gnuplot "nonuniform matrix" format
	fmt.Printf("%d ", len(windows)+1)
	for _, windowNS := range windows {
		fmt.Printf("%d ", windowNS)
	}
	fmt.Print("\n")
	utils := vec.Linspace(0, 1, 100)
	for _, util := range utils {
		fmt.Printf("%g ", util)
		for _, mud := range muds {
			fmt.Printf("%g ", mud.CDF(util))
		}
		fmt.Print("\n")
	}
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:21,代碼來源:main.go

示例6: doMUT

func doMUT(s *gcstats.GcStats) {
	windows := vec.Logspace(-3, 0, samples, 10)
	muds := make(map[float64]*gcstats.MUD)
	for _, window := range windows {
		muds[window] = s.MutatorUtilizationDistribution(int(window * 1e9))
	}

	plot := newPlot("granularity", windows, "--style", "mut")
	type config struct {
		label string
		x     float64
	}
	for _, c := range []config{
		{"100%ile", 0},
		{"99.9%ile", 0.001},
		{"99%ile", 0.01},
		{"90%ile", 0.1},
	} {
		plot.addSeries(c.label, func(x float64) float64 {
			return muds[x].InvCDF(c.x)
		})
	}
	showPlot(plot)
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:24,代碼來源:main.go

示例7: doSummary

func doSummary(s *gcstats.GcStats) {
	// Pause time: Max, 99th %ile, 95th %ile, mean
	// Mutator utilization
	// 50ms mutator utilization: Min, 1st %ile, 5th %ile
	pauseTimes := stats.Sample{Xs: []float64{}}
	for _, stop := range s.Stops() {
		pauseTimes.Xs = append(pauseTimes.Xs, float64(stop.Duration))
	}
	pauseTimes.Sort()
	fmt.Print("Pause times: max=", ns(pauseTimes.Percentile(1)), " 99th %ile=", ns(pauseTimes.Percentile(.99)), " 95th %ile=", ns(pauseTimes.Percentile(.95)), " mean=", ns(pauseTimes.Mean()), "\n")

	if s.HaveProgTimes() {
		fmt.Print("Mutator utilization: ", pct(s.MutatorUtilization()), "\n")

		fmt.Print("50ms mutator utilization: min=", pct(s.MMUs([]int{50000000})[0]), "\n")
	}
}
開發者ID:rchunping,項目名稱:go-gcstats,代碼行數:17,代碼來源:main.go


注:本文中的github.com/aclements/go-gcstats/gcstats.GcStats類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。