Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.1
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
testing /
[ HOME SHELL ]
Name
Size
Permission
Action
internal
[ DIR ]
drwxr-xr-x
iotest
[ DIR ]
drwxr-xr-x
quick
[ DIR ]
drwxr-xr-x
allocs.go
1.36
KB
-rw-r--r--
allocs_test.go
825
B
-rw-r--r--
benchmark.go
22.34
KB
-rw-r--r--
benchmark_test.go
3.94
KB
-rw-r--r--
cover.go
3.26
KB
-rw-r--r--
example.go
2.5
KB
-rw-r--r--
export_test.go
207
B
-rw-r--r--
helper_test.go
1.63
KB
-rw-r--r--
helperfuncs_test.go
1.34
KB
-rw-r--r--
match.go
3.51
KB
-rw-r--r--
match_test.go
5.11
KB
-rw-r--r--
panic_test.go
6.04
KB
-rw-r--r--
run_example.go
1.21
KB
-rw-r--r--
run_example_js.go
1.68
KB
-rw-r--r--
sub_test.go
21.82
KB
-rw-r--r--
testing.go
47.33
KB
-rw-r--r--
testing_test.go
448
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : benchmark_test.go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package testing_test import ( "bytes" "runtime" "sort" "strings" "sync/atomic" "testing" "text/template" "time" ) var prettyPrintTests = []struct { v float64 expected string }{ {0, " 0 x"}, {1234.1, " 1234 x"}, {-1234.1, " -1234 x"}, {99.950001, " 100 x"}, {99.949999, " 99.9 x"}, {9.9950001, " 10.0 x"}, {9.9949999, " 9.99 x"}, {-9.9949999, " -9.99 x"}, {0.0099950001, " 0.0100 x"}, {0.0099949999, " 0.00999 x"}, } func TestPrettyPrint(t *testing.T) { for _, tt := range prettyPrintTests { buf := new(strings.Builder) testing.PrettyPrint(buf, tt.v, "x") if tt.expected != buf.String() { t.Errorf("prettyPrint(%v): expected %q, actual %q", tt.v, tt.expected, buf.String()) } } } func TestResultString(t *testing.T) { // Test fractional ns/op handling r := testing.BenchmarkResult{ N: 100, T: 240 * time.Nanosecond, } if r.NsPerOp() != 2 { t.Errorf("NsPerOp: expected 2, actual %v", r.NsPerOp()) } if want, got := " 100\t 2.40 ns/op", r.String(); want != got { t.Errorf("String: expected %q, actual %q", want, got) } // Test sub-1 ns/op (issue #31005) r.T = 40 * time.Nanosecond if want, got := " 100\t 0.400 ns/op", r.String(); want != got { t.Errorf("String: expected %q, actual %q", want, got) } // Test 0 ns/op r.T = 0 if want, got := " 100", r.String(); want != got { t.Errorf("String: expected %q, actual %q", want, got) } } func TestRunParallel(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } testing.Benchmark(func(b *testing.B) { procs := uint32(0) iters := uint64(0) b.SetParallelism(3) b.RunParallel(func(pb *testing.PB) { atomic.AddUint32(&procs, 1) for pb.Next() { atomic.AddUint64(&iters, 1) } }) if want := uint32(3 * runtime.GOMAXPROCS(0)); procs != want { t.Errorf("got %v procs, want %v", procs, want) } if iters != uint64(b.N) { t.Errorf("got %v iters, want %v", iters, b.N) } }) } func TestRunParallelFail(t *testing.T) { testing.Benchmark(func(b *testing.B) { b.RunParallel(func(pb *testing.PB) { // The function must be able to log/abort // w/o crashing/deadlocking the whole benchmark. b.Log("log") b.Error("error") }) }) } func ExampleB_RunParallel() { // Parallel benchmark for text/template.Template.Execute on a single object. testing.Benchmark(func(b *testing.B) { templ := template.Must(template.New("test").Parse("Hello, {{.}}!")) // RunParallel will create GOMAXPROCS goroutines // and distribute work among them. b.RunParallel(func(pb *testing.PB) { // Each goroutine has its own bytes.Buffer. var buf bytes.Buffer for pb.Next() { // The loop body is executed b.N times total across all goroutines. buf.Reset() templ.Execute(&buf, "World") } }) }) } func TestReportMetric(t *testing.T) { res := testing.Benchmark(func(b *testing.B) { b.ReportMetric(12345, "ns/op") b.ReportMetric(0.2, "frobs/op") }) // Test built-in overriding. if res.NsPerOp() != 12345 { t.Errorf("NsPerOp: expected %v, actual %v", 12345, res.NsPerOp()) } // Test stringing. res.N = 1 // Make the output stable want := " 1\t 12345 ns/op\t 0.200 frobs/op" if want != res.String() { t.Errorf("expected %q, actual %q", want, res.String()) } } func ExampleB_ReportMetric() { // This reports a custom benchmark metric relevant to a // specific algorithm (in this case, sorting). testing.Benchmark(func(b *testing.B) { var compares int64 for i := 0; i < b.N; i++ { s := []int{5, 4, 3, 2, 1} sort.Slice(s, func(i, j int) bool { compares++ return s[i] < s[j] }) } // This metric is per-operation, so divide by b.N and // report it as a "/op" unit. b.ReportMetric(float64(compares)/float64(b.N), "compares/op") }) }
Close