Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go123
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go123
Commits
155506a9
Commit
155506a9
authored
Jul 14, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: ~gofmt
parent
0399d7ad
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
112 additions
and
107 deletions
+112
-107
cmd/gmigrate/gmigrate.go
cmd/gmigrate/gmigrate.go
+7
-8
exc/error.go
exc/error.go
+4
-3
mem/buffer_test.go
mem/buffer_test.go
+1
-0
prog/prog.go
prog/prog.go
+8
-8
tracing/cmd/gotrace/gotrace.go
tracing/cmd/gotrace/gotrace.go
+1
-1
tracing/internal/race/race.go
tracing/internal/race/race.go
+1
-0
tracing/internal/race/race_norace.go
tracing/internal/race/race_norace.go
+1
-0
tracing/internal/xruntime/race.go
tracing/internal/xruntime/race.go
+1
-0
tracing/internal/xruntime/race_norace.go
tracing/internal/xruntime/race_norace.go
+1
-0
tracing/internal/xruntime/runtime_test.go
tracing/internal/xruntime/runtime_test.go
+1
-1
tracing/tracetest/chan.go
tracing/tracetest/chan.go
+1
-1
tracing/tracetest/tracetest.go
tracing/tracetest/tracetest.go
+12
-12
tracing/tracing.go
tracing/tracing.go
+14
-14
xbufio/seqbuf_ioat.go
xbufio/seqbuf_ioat.go
+8
-8
xbufio/seqbuf_ioat_test.go
xbufio/seqbuf_ioat_test.go
+1
-1
xcontext/xcontext.go
xcontext/xcontext.go
+7
-7
xerr/xerr.go
xerr/xerr.go
+12
-14
xfmt/fmt.go
xfmt/fmt.go
+6
-6
xio/xio.go
xio/xio.go
+10
-10
xmath/math18.go
xmath/math18.go
+1
-0
xmath/math19.go
xmath/math19.go
+1
-0
xnet/trace.go
xnet/trace.go
+3
-3
xnet/virtnet/interfaces.go
xnet/virtnet/interfaces.go
+4
-4
xnet/virtnet/virtnet.go
xnet/virtnet/virtnet.go
+2
-4
xnet/virtnet/virtnet_test.go
xnet/virtnet/virtnet_test.go
+2
-2
xruntime/race/race_norace.go
xruntime/race/race_norace.go
+1
-0
xruntime/race/race_race.go
xruntime/race/race_race.go
+1
-0
No files found.
cmd/gmigrate/gmigrate.go
View file @
155506a9
...
@@ -22,13 +22,12 @@
...
@@ -22,13 +22,12 @@
// usage: `go tool trace -d <trace.out> |gmigrate`
// usage: `go tool trace -d <trace.out> |gmigrate`
package
main
package
main
import
(
import
(
"bufio"
"bufio"
"errors"
"errors"
"fmt"
"io"
"io"
"log"
"log"
"fmt"
"os"
"os"
"regexp"
"regexp"
"sort"
"sort"
...
@@ -76,7 +75,7 @@ func main() {
...
@@ -76,7 +75,7 @@ func main() {
in
:=
bufio
.
NewReader
(
os
.
Stdin
)
in
:=
bufio
.
NewReader
(
os
.
Stdin
)
tstart
,
tend
,
tprev
:=
-
1
,
-
1
,
-
1
tstart
,
tend
,
tprev
:=
-
1
,
-
1
,
-
1
for
lineno
:=
1
;
;
lineno
++
{
for
lineno
:=
1
;
;
lineno
++
{
bad
:=
func
(
err
error
)
{
bad
:=
func
(
err
error
)
{
log
.
Fatalf
(
"%d: %v"
,
lineno
,
err
)
log
.
Fatalf
(
"%d: %v"
,
lineno
,
err
)
}
}
...
...
exc/error.go
View file @
155506a9
...
@@ -112,6 +112,7 @@ func Raisef(format string, a ...interface{}) {
...
@@ -112,6 +112,7 @@ func Raisef(format string, a ...interface{}) {
// Raiseif raises if err != nil.
// Raiseif raises if err != nil.
//
//
// NOTE err can be != nil even if typed obj = nil:
// NOTE err can be != nil even if typed obj = nil:
//
// var obj *T;
// var obj *T;
// err = obj
// err = obj
// err != nil is true
// err != nil is true
...
...
mem/buffer_test.go
View file @
155506a9
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
// As of go19 sync.Pool under race-detector randomly drops items on the floor
// As of go19 sync.Pool under race-detector randomly drops items on the floor
// https://github.com/golang/go/blob/ca360c39/src/sync/pool.go#L92
// https://github.com/golang/go/blob/ca360c39/src/sync/pool.go#L92
// so it is not possible to verify we will get what we've just put there.
// so it is not possible to verify we will get what we've just put there.
//go:build !race
// +build !race
// +build !race
package
mem
package
mem
...
...
prog/prog.go
View file @
155506a9
...
@@ -37,8 +37,8 @@ import (
...
@@ -37,8 +37,8 @@ import (
type
Command
struct
{
type
Command
struct
{
Name
string
Name
string
Summary
string
Summary
string
Usage
func
(
w
io
.
Writer
)
Usage
func
(
w
io
.
Writer
)
Main
func
(
argv
[]
string
)
Main
func
(
argv
[]
string
)
}
}
// CommandRegistry is ordered collection of Commands.
// CommandRegistry is ordered collection of Commands.
...
...
tracing/cmd/gotrace/gotrace.go
View file @
155506a9
tracing/internal/race/race.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race
// +build race
package
race
package
race
...
...
tracing/internal/race/race_norace.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race
// +build !race
package
race
package
race
...
...
tracing/internal/xruntime/race.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race
// +build race
package
xruntime
package
xruntime
...
...
tracing/internal/xruntime/race_norace.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race
// +build !race
package
xruntime
package
xruntime
...
...
tracing/internal/xruntime/runtime_test.go
View file @
155506a9
...
@@ -79,7 +79,7 @@ func TestStartStopTheWorld(t *testing.T) {
...
@@ -79,7 +79,7 @@ func TestStartStopTheWorld(t *testing.T) {
nδ
:=
0
nδ
:=
0
tstart
:=
time
.
Now
()
tstart
:=
time
.
Now
()
for
time
.
Now
()
.
Sub
(
tstart
)
<
time
.
Second
{
for
time
.
Now
()
.
Sub
(
tstart
)
<
time
.
Second
{
for
i
:=
0
;
i
<
100
;
i
++
{
for
i
:=
0
;
i
<
100
;
i
++
{
xnext
=
atomic
.
LoadInt32
(
&
x
)
xnext
=
atomic
.
LoadInt32
(
&
x
)
if
xnext
!=
xprev
{
if
xnext
!=
xprev
{
nδ
+=
1
nδ
+=
1
...
...
tracing/tracetest/chan.go
View file @
155506a9
...
@@ -37,7 +37,7 @@ var (
...
@@ -37,7 +37,7 @@ var (
//
//
// The goroutine which sent the message will wait for Ack before continue.
// The goroutine which sent the message will wait for Ack before continue.
type
_Msg
struct
{
type
_Msg
struct
{
Event
interface
{}
Event
interface
{}
ack
chan
<-
error
// nil on Ack; !nil on nak
ack
chan
<-
error
// nil on Ack; !nil on nak
}
}
...
...
tracing/tracetest/tracetest.go
View file @
155506a9
...
@@ -104,12 +104,12 @@ package tracetest
...
@@ -104,12 +104,12 @@ package tracetest
import
(
import
(
"fmt"
"fmt"
"path/filepath"
"path/filepath"
"sort"
"strings"
"sync"
"reflect"
"reflect"
"runtime"
"runtime"
"runtime/debug"
"runtime/debug"
"sort"
"strings"
"sync"
"testing"
"testing"
"time"
"time"
...
...
tracing/tracing.go
View file @
155506a9
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
/*
/*
Package tracing provides usage and runtime support for Go tracing facilities.
Package tracing provides usage and runtime support for Go tracing facilities.
Trace events
#
Trace events
A Go package can define several events of interest to trace via special
A Go package can define several events of interest to trace via special
comments. With such definition a tracing event becomes associated with trace
comments. With such definition a tracing event becomes associated with trace
...
@@ -40,7 +40,7 @@ function that is used to signal when the event happens. For example:
...
@@ -40,7 +40,7 @@ function that is used to signal when the event happens. For example:
By default using trace function does nothing and has very small overhead(*).
By default using trace function does nothing and has very small overhead(*).
Probes
#
Probes
However it is possible to attach probing functions to events. A probe, once
However it is possible to attach probing functions to events. A probe, once
attached, is called whenever event is signalled in the context which triggered
attached, is called whenever event is signalled in the context which triggered
...
@@ -100,7 +100,7 @@ Three ways particularly are well-understood and handy:
...
@@ -100,7 +100,7 @@ Three ways particularly are well-understood and handy:
- synchronous tracing
- synchronous tracing
Recording events stream
#
Recording events stream
To get better understanding of what happens when it is possible to record
To get better understanding of what happens when it is possible to record
events into a stream and later either visualize or postprocess them.
events into a stream and later either visualize or postprocess them.
...
@@ -117,7 +117,7 @@ understood by chromium trace-viewer: https://github.com/catapult-project/catapul
...
@@ -117,7 +117,7 @@ understood by chromium trace-viewer: https://github.com/catapult-project/catapul
NOTE there is also talk/work to implement user events for runtime/trace: https://golang.org/issues/16619.
NOTE there is also talk/work to implement user events for runtime/trace: https://golang.org/issues/16619.
Profiling
#
Profiling
A profile is aggregate summary of collection of stack traces showing the call sequences that led
A profile is aggregate summary of collection of stack traces showing the call sequences that led
to instances of a particular event. One could create runtime/pprof.Profile and
to instances of a particular event. One could create runtime/pprof.Profile and
...
@@ -131,7 +131,7 @@ XXX Profile.Add needs unique value for each invocation - how do we do? Provide N
...
@@ -131,7 +131,7 @@ XXX Profile.Add needs unique value for each invocation - how do we do? Provide N
XXX should tracing provide more tight integration with runtime/pprof.Profile?
XXX should tracing provide more tight integration with runtime/pprof.Profile?
Synchronous tracing
#
Synchronous tracing
For testing purposes it is sometimes practical to leverage the property that
For testing purposes it is sometimes practical to leverage the property that
probes pause original code execution until the probe run is finished. That
probes pause original code execution until the probe run is finished. That
...
@@ -149,7 +149,7 @@ a set of goroutines in tested code in question
...
@@ -149,7 +149,7 @@ a set of goroutines in tested code in question
Please see package lab.nexedi.com/kirr/go123/tracing/tracetest for details.
Please see package lab.nexedi.com/kirr/go123/tracing/tracetest for details.
Cross package tracing
#
Cross package tracing
Trace events are not part of exported package API with rationale that package's
Trace events are not part of exported package API with rationale that package's
regular API and internal trace events usually have different stability
regular API and internal trace events usually have different stability
...
@@ -172,7 +172,7 @@ available as regular functions prefixed with imported package name:
...
@@ -172,7 +172,7 @@ available as regular functions prefixed with imported package name:
...
...
Gotrace
#
Gotrace
The way //trace:event and //trace:import work is via additional code being
The way //trace:event and //trace:import work is via additional code being
generated for them. Whenever a package uses any //trace: directive,
generated for them. Whenever a package uses any //trace: directive,
...
...
xbufio/seqbuf_ioat.go
View file @
155506a9
...
@@ -22,7 +22,6 @@ package xbufio
...
@@ -22,7 +22,6 @@ package xbufio
import
(
import
(
"io"
"io"
//"log"
//"log"
)
)
...
@@ -31,6 +30,7 @@ import (
...
@@ -31,6 +30,7 @@ import (
// Both forward, backward and interleaved forward/backward access patterns are supported
// Both forward, backward and interleaved forward/backward access patterns are supported
//
//
// NOTE SeqReaderAt is not safe to use from multiple goroutines concurrently.
// NOTE SeqReaderAt is not safe to use from multiple goroutines concurrently.
//
// Strictly speaking this goes against io.ReaderAt interface but sequential
// Strictly speaking this goes against io.ReaderAt interface but sequential
// workloads usually mean sequential processing. It would be a pity to
// workloads usually mean sequential processing. It would be a pity to
// add mutex for nothing.
// add mutex for nothing.
...
...
xbufio/seqbuf_ioat_test.go
View file @
155506a9
...
@@ -232,7 +232,7 @@ func TestSeqReaderAt(t *testing.T) {
...
@@ -232,7 +232,7 @@ func TestSeqReaderAt(t *testing.T) {
}
}
// verify buffer state
// verify buffer state
if
!
(
rb
.
pos
==
tt
.
bufPos
&&
len
(
rb
.
buf
)
==
tt
.
bufLen
){
if
!
(
rb
.
pos
==
tt
.
bufPos
&&
len
(
rb
.
buf
)
==
tt
.
bufLen
)
{
t
.
Fatalf
(
"%v: -> unexpected buffer state @%v #%v"
,
tt
,
rb
.
pos
,
len
(
rb
.
buf
))
t
.
Fatalf
(
"%v: -> unexpected buffer state @%v #%v"
,
tt
,
rb
.
pos
,
len
(
rb
.
buf
))
}
}
}
}
...
...
xcontext/xcontext.go
View file @
155506a9
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
// Package xcontext provides addons to std package context.
// Package xcontext provides addons to std package context.
//
//
// Merging contexts
//
#
Merging contexts
//
//
// Merge could be handy in situations where spawned job needs to be canceled
// Merge could be handy in situations where spawned job needs to be canceled
// whenever any of 2 contexts becomes done. This frequently arises with service
// whenever any of 2 contexts becomes done. This frequently arises with service
...
...
xerr/xerr.go
View file @
155506a9
...
@@ -19,8 +19,7 @@
...
@@ -19,8 +19,7 @@
// Package xerr provides addons for error-handling.
// Package xerr provides addons for error-handling.
//
//
//
// # Error context
// Error context
//
//
// Context and Contextf are handy to concisely add context to returned error,
// Context and Contextf are handy to concisely add context to returned error,
// for example:
// for example:
...
@@ -37,8 +36,7 @@
...
@@ -37,8 +36,7 @@
// returned error. Please see package github.com/pkg/errors for details on
// returned error. Please see package github.com/pkg/errors for details on
// this topic.
// this topic.
//
//
//
// # Error vector
// Error vector
//
//
// Sometimes there are several operations performed and we want to collect
// Sometimes there are several operations performed and we want to collect
// errors from them all. For this Errorv could be used which is vector of
// errors from them all. For this Errorv could be used which is vector of
...
...
xfmt/fmt.go
View file @
155506a9
...
@@ -187,7 +187,7 @@ func AppendHex016(b []byte, x uint64) []byte {
...
@@ -187,7 +187,7 @@ func AppendHex016(b []byte, x uint64) []byte {
b
=
xbytes
.
Grow
(
b
,
16
)
b
=
xbytes
.
Grow
(
b
,
16
)
bb
:=
b
[
l
:
]
bb
:=
b
[
l
:
]
for
i
:=
15
;
i
>=
0
;
i
--
{
for
i
:=
15
;
i
>=
0
;
i
--
{
bb
[
i
]
=
hexdigits
[
x
&
0xf
]
bb
[
i
]
=
hexdigits
[
x
&
0xf
]
x
>>=
4
x
>>=
4
}
}
return
b
return
b
...
...
xio/xio.go
View file @
155506a9
xmath/math18.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !go1.9
// +build !go1.9
// +build !go1.9
package
xmath
package
xmath
...
...
xmath/math19.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build go1.9
// +build go1.9
// +build go1.9
// Package xmath provides addons to std math package.
// Package xmath provides addons to std math package.
...
...
xnet/trace.go
View file @
155506a9
xnet/virtnet/interfaces.go
View file @
155506a9
xnet/virtnet/virtnet.go
View file @
155506a9
...
@@ -27,8 +27,7 @@
...
@@ -27,8 +27,7 @@
// Package virtnet provides infrastructure for using and implementing such
// Package virtnet provides infrastructure for using and implementing such
// TCP-like virtual networks.
// TCP-like virtual networks.
//
//
//
// # Using virtnet networks
// Using virtnet networks
//
//
// Addresses on a virtnet network are host:port pairs represented by Addr.
// Addresses on a virtnet network are host:port pairs represented by Addr.
// A network conceptually consists of several SubNetworks each being home for
// A network conceptually consists of several SubNetworks each being home for
...
@@ -49,8 +48,7 @@
...
@@ -49,8 +48,7 @@
// lab.nexedi.com/kirr/go123/xnet/pipenet for particular well-known
// lab.nexedi.com/kirr/go123/xnet/pipenet for particular well-known
// virtnet-based networks.
// virtnet-based networks.
//
//
//
// # Implementing virtnet networks
// Implementing virtnet networks
//
//
// To implement a virtnet-based network one need to implement Engine and Registry.
// To implement a virtnet-based network one need to implement Engine and Registry.
//
//
...
...
xnet/virtnet/virtnet_test.go
View file @
155506a9
xruntime/race/race_norace.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race
// +build !race
// Package race complements standard package runtime/race.
// Package race complements standard package runtime/race.
...
...
xruntime/race/race_race.go
View file @
155506a9
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race
// +build race
package
race
package
race
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment