id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
147,500
soniakeys/quant
palette.go
Walk
func (t TreePalette) Walk(f func(leaf *Node, i int)) { i := 0 var w func(*Node) w = func(n *Node) { if n.Type == TLeaf { f(n, i) i++ return } w(n.Low) w(n.High) } w(t.Root) }
go
func (t TreePalette) Walk(f func(leaf *Node, i int)) { i := 0 var w func(*Node) w = func(n *Node) { if n.Type == TLeaf { f(n, i) i++ return } w(n.Low) w(n.High) } w(t.Root) }
[ "func", "(", "t", "TreePalette", ")", "Walk", "(", "f", "func", "(", "leaf", "*", "Node", ",", "i", "int", ")", ")", "{", "i", ":=", "0", "\n", "var", "w", "func", "(", "*", "Node", ")", "\n", "w", "=", "func", "(", "n", "*", "Node", ")", ...
// Walk walks the TreePalette calling f for each color.
[ "Walk", "walks", "the", "TreePalette", "calling", "f", "for", "each", "color", "." ]
0a3861b3bd925b434c67c93a15633ced8475092d
https://github.com/soniakeys/quant/blob/0a3861b3bd925b434c67c93a15633ced8475092d/palette.go#L146-L159
147,501
kataras/go-fs
fs.go
CopyFile
func CopyFile(source string, destination string) error { reader, err := os.Open(source) if err != nil { return errFileOpen.Format(err.Error()) } defer reader.Close() writer, err := os.Create(destination) if err != nil { return errFileCreate.Format(err.Error()) } defer writer.Close() _, err = io.Copy(w...
go
func CopyFile(source string, destination string) error { reader, err := os.Open(source) if err != nil { return errFileOpen.Format(err.Error()) } defer reader.Close() writer, err := os.Create(destination) if err != nil { return errFileCreate.Format(err.Error()) } defer writer.Close() _, err = io.Copy(w...
[ "func", "CopyFile", "(", "source", "string", ",", "destination", "string", ")", "error", "{", "reader", ",", "err", ":=", "os", ".", "Open", "(", "source", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "errFileOpen", ".", "Format", "(", "err", ...
// CopyFile accepts full path of the source and full path of destination, if file exists it's overrides it // this function doesn't checks for permissions and all that, it returns an error
[ "CopyFile", "accepts", "full", "path", "of", "the", "source", "and", "full", "path", "of", "destination", "if", "file", "exists", "it", "s", "overrides", "it", "this", "function", "doesn", "t", "checks", "for", "permissions", "and", "all", "that", "it", "r...
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/fs.go#L86-L113
147,502
kataras/go-fs
fs.go
CopyDir
func CopyDir(source string, dest string) (err error) { // get properties of source dir fi, err := os.Stat(source) if err != nil { return err } if !fi.IsDir() { return errNotDir.Format(source) } // create dest dir err = os.MkdirAll(dest, fi.Mode()) if err != nil { return err } entries, err := iouti...
go
func CopyDir(source string, dest string) (err error) { // get properties of source dir fi, err := os.Stat(source) if err != nil { return err } if !fi.IsDir() { return errNotDir.Format(source) } // create dest dir err = os.MkdirAll(dest, fi.Mode()) if err != nil { return err } entries, err := iouti...
[ "func", "CopyDir", "(", "source", "string", ",", "dest", "string", ")", "(", "err", "error", ")", "{", "// get properties of source dir", "fi", ",", "err", ":=", "os", ".", "Stat", "(", "source", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err...
// CopyDir recursively copies a directory tree, attempting to preserve permissions. // Source directory must exist.
[ "CopyDir", "recursively", "copies", "a", "directory", "tree", "attempting", "to", "preserve", "permissions", ".", "Source", "directory", "must", "exist", "." ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/fs.go#L117-L157
147,503
kataras/go-fs
compression.go
AcquireGzipWriter
func (p *GzipPool) AcquireGzipWriter(w io.Writer) *gzip.Writer { v := p.Get() if v == nil { gzipWriter, err := gzip.NewWriterLevel(w, p.Level) if err != nil { return nil } return gzipWriter } gzipWriter := v.(*gzip.Writer) gzipWriter.Reset(w) return gzipWriter }
go
func (p *GzipPool) AcquireGzipWriter(w io.Writer) *gzip.Writer { v := p.Get() if v == nil { gzipWriter, err := gzip.NewWriterLevel(w, p.Level) if err != nil { return nil } return gzipWriter } gzipWriter := v.(*gzip.Writer) gzipWriter.Reset(w) return gzipWriter }
[ "func", "(", "p", "*", "GzipPool", ")", "AcquireGzipWriter", "(", "w", "io", ".", "Writer", ")", "*", "gzip", ".", "Writer", "{", "v", ":=", "p", ".", "Get", "(", ")", "\n", "if", "v", "==", "nil", "{", "gzipWriter", ",", "err", ":=", "gzip", "...
// AcquireGzipWriter prepares a gzip writer and returns it // // see ReleaseGzipWriter
[ "AcquireGzipWriter", "prepares", "a", "gzip", "writer", "and", "returns", "it", "see", "ReleaseGzipWriter" ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/compression.go#L52-L64
147,504
kataras/go-fs
installer.go
DownloadZip
func DownloadZip(zipURL string, newDir string, showOutputIndication bool) (string, error) { var err error var size int64 if showOutputIndication { finish := ShowIndicator(os.Stdout, true) defer func() { finish <- true }() } os.MkdirAll(newDir, 0755) tokens := strings.Split(zipURL, "/") fileName := new...
go
func DownloadZip(zipURL string, newDir string, showOutputIndication bool) (string, error) { var err error var size int64 if showOutputIndication { finish := ShowIndicator(os.Stdout, true) defer func() { finish <- true }() } os.MkdirAll(newDir, 0755) tokens := strings.Split(zipURL, "/") fileName := new...
[ "func", "DownloadZip", "(", "zipURL", "string", ",", "newDir", "string", ",", "showOutputIndication", "bool", ")", "(", "string", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "size", "int64", "\n", "if", "showOutputIndication", "{", "finish", ...
// DownloadZip downloads a zip file returns the downloaded filename and an error.
[ "DownloadZip", "downloads", "a", "zip", "file", "returns", "the", "downloaded", "filename", "and", "an", "error", "." ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/installer.go#L62-L102
147,505
kataras/go-fs
http.go
FaviconHandler
func FaviconHandler(favPath string) http.Handler { f, err := os.Open(favPath) if err != nil { panic(errFileOpen.Format(favPath, err.Error())) } defer f.Close() fi, _ := f.Stat() if fi.IsDir() { // if it's dir the try to get the favicon.ico fav := path.Join(favPath, "favicon.ico") f, err = os.Open(fav) if ...
go
func FaviconHandler(favPath string) http.Handler { f, err := os.Open(favPath) if err != nil { panic(errFileOpen.Format(favPath, err.Error())) } defer f.Close() fi, _ := f.Stat() if fi.IsDir() { // if it's dir the try to get the favicon.ico fav := path.Join(favPath, "favicon.ico") f, err = os.Open(fav) if ...
[ "func", "FaviconHandler", "(", "favPath", "string", ")", "http", ".", "Handler", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "favPath", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "errFileOpen", ".", "Format", "(", "favPath", ",",...
// FaviconHandler receives the favicon path and serves the favicon
[ "FaviconHandler", "receives", "the", "favicon", "path", "and", "serves", "the", "favicon" ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/http.go#L119-L146
147,506
mailhog/data
message.go
NewMessageID
func NewMessageID(hostname string) (MessageID, error) { size := 32 rb := make([]byte, size) _, err := rand.Read(rb) if err != nil { return MessageID(""), err } rs := base64.URLEncoding.EncodeToString(rb) return MessageID(rs + "@" + hostname), nil }
go
func NewMessageID(hostname string) (MessageID, error) { size := 32 rb := make([]byte, size) _, err := rand.Read(rb) if err != nil { return MessageID(""), err } rs := base64.URLEncoding.EncodeToString(rb) return MessageID(rs + "@" + hostname), nil }
[ "func", "NewMessageID", "(", "hostname", "string", ")", "(", "MessageID", ",", "error", ")", "{", "size", ":=", "32", "\n\n", "rb", ":=", "make", "(", "[", "]", "byte", ",", "size", ")", "\n", "_", ",", "err", ":=", "rand", ".", "Read", "(", "rb"...
// NewMessageID generates a new message ID
[ "NewMessageID", "generates", "a", "new", "message", "ID" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L30-L43
147,507
mailhog/data
message.go
Parse
func (m *SMTPMessage) Parse(hostname string) *Message { var arr []*Path for _, path := range m.To { arr = append(arr, PathFromString(path)) } id, _ := NewMessageID(hostname) msg := &Message{ ID: id, From: PathFromString(m.From), To: arr, Content: ContentFromString(m.Data), Created: time.N...
go
func (m *SMTPMessage) Parse(hostname string) *Message { var arr []*Path for _, path := range m.To { arr = append(arr, PathFromString(path)) } id, _ := NewMessageID(hostname) msg := &Message{ ID: id, From: PathFromString(m.From), To: arr, Content: ContentFromString(m.Data), Created: time.N...
[ "func", "(", "m", "*", "SMTPMessage", ")", "Parse", "(", "hostname", "string", ")", "*", "Message", "{", "var", "arr", "[", "]", "*", "Path", "\n", "for", "_", ",", "path", ":=", "range", "m", ".", "To", "{", "arr", "=", "append", "(", "arr", "...
// Parse converts a raw SMTP message to a parsed MIME message
[ "Parse", "converts", "a", "raw", "SMTP", "message", "to", "a", "parsed", "MIME", "message" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L90-L148
147,508
mailhog/data
message.go
IsMIME
func (content *Content) IsMIME() bool { header, ok := content.Headers["Content-Type"] if !ok { return false } return strings.HasPrefix(header[0], "multipart/") }
go
func (content *Content) IsMIME() bool { header, ok := content.Headers["Content-Type"] if !ok { return false } return strings.HasPrefix(header[0], "multipart/") }
[ "func", "(", "content", "*", "Content", ")", "IsMIME", "(", ")", "bool", "{", "header", ",", "ok", ":=", "content", ".", "Headers", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "return", "strings", ".", "H...
// IsMIME detects a valid MIME header
[ "IsMIME", "detects", "a", "valid", "MIME", "header" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L216-L222
147,509
mailhog/data
message.go
ParseMIMEBody
func (content *Content) ParseMIMEBody() *MIMEBody { var parts []*Content if hdr, ok := content.Headers["Content-Type"]; ok { if len(hdr) > 0 { boundary := extractBoundary(hdr[0]) var p []string if len(boundary) > 0 { p = strings.Split(content.Body, "--"+boundary) logf("Got boundary: %s", boundary)...
go
func (content *Content) ParseMIMEBody() *MIMEBody { var parts []*Content if hdr, ok := content.Headers["Content-Type"]; ok { if len(hdr) > 0 { boundary := extractBoundary(hdr[0]) var p []string if len(boundary) > 0 { p = strings.Split(content.Body, "--"+boundary) logf("Got boundary: %s", boundary)...
[ "func", "(", "content", "*", "Content", ")", "ParseMIMEBody", "(", ")", "*", "MIMEBody", "{", "var", "parts", "[", "]", "*", "Content", "\n\n", "if", "hdr", ",", "ok", ":=", "content", ".", "Headers", "[", "\"", "\"", "]", ";", "ok", "{", "if", "...
// ParseMIMEBody parses SMTP message content into multiple MIME parts
[ "ParseMIMEBody", "parses", "SMTP", "message", "content", "into", "multiple", "MIME", "parts" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L225-L255
147,510
mailhog/data
message.go
PathFromString
func PathFromString(path string) *Path { var relays []string email := path if strings.Contains(path, ":") { x := strings.SplitN(path, ":", 2) r, e := x[0], x[1] email = e relays = strings.Split(r, ",") } mailbox, domain := "", "" if strings.Contains(email, "@") { x := strings.SplitN(email, "@", 2) mai...
go
func PathFromString(path string) *Path { var relays []string email := path if strings.Contains(path, ":") { x := strings.SplitN(path, ":", 2) r, e := x[0], x[1] email = e relays = strings.Split(r, ",") } mailbox, domain := "", "" if strings.Contains(email, "@") { x := strings.SplitN(email, "@", 2) mai...
[ "func", "PathFromString", "(", "path", "string", ")", "*", "Path", "{", "var", "relays", "[", "]", "string", "\n", "email", ":=", "path", "\n", "if", "strings", ".", "Contains", "(", "path", ",", "\"", "\"", ")", "{", "x", ":=", "strings", ".", "Sp...
// PathFromString parses a forward-path or reverse-path into its parts
[ "PathFromString", "parses", "a", "forward", "-", "path", "or", "reverse", "-", "path", "into", "its", "parts" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L258-L281
147,511
mailhog/data
message.go
ContentFromString
func ContentFromString(data string) *Content { logf("Parsing Content from string: '%s'", data) x := strings.SplitN(data, "\r\n\r\n", 2) h := make(map[string][]string, 0) // FIXME this fails if the message content has no headers - specifically, // if it doesn't contain \r\n\r\n if len(x) == 2 { headers, body :...
go
func ContentFromString(data string) *Content { logf("Parsing Content from string: '%s'", data) x := strings.SplitN(data, "\r\n\r\n", 2) h := make(map[string][]string, 0) // FIXME this fails if the message content has no headers - specifically, // if it doesn't contain \r\n\r\n if len(x) == 2 { headers, body :...
[ "func", "ContentFromString", "(", "data", "string", ")", "*", "Content", "{", "logf", "(", "\"", "\"", ",", "data", ")", "\n", "x", ":=", "strings", ".", "SplitN", "(", "data", ",", "\"", "\\r", "\\n", "\\r", "\\n", "\"", ",", "2", ")", "\n", "h"...
// ContentFromString parses SMTP content into separate headers and body
[ "ContentFromString", "parses", "SMTP", "content", "into", "separate", "headers", "and", "body" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L284-L320
147,512
mailhog/data
message.go
extractBoundary
func extractBoundary(contentType string) string { _, params, err := mime.ParseMediaType(contentType) if err == nil { return params["boundary"] } return "" }
go
func extractBoundary(contentType string) string { _, params, err := mime.ParseMediaType(contentType) if err == nil { return params["boundary"] } return "" }
[ "func", "extractBoundary", "(", "contentType", "string", ")", "string", "{", "_", ",", "params", ",", "err", ":=", "mime", ".", "ParseMediaType", "(", "contentType", ")", "\n", "if", "err", "==", "nil", "{", "return", "params", "[", "\"", "\"", "]", "\...
// extractBoundary extract boundary string in contentType. // It returns empty string if no valid boundary found
[ "extractBoundary", "extract", "boundary", "string", "in", "contentType", ".", "It", "returns", "empty", "string", "if", "no", "valid", "boundary", "found" ]
024d554958b5bea5db220bfd84922a584d878ded
https://github.com/mailhog/data/blob/024d554958b5bea5db220bfd84922a584d878ded/message.go#L324-L330
147,513
kataras/go-fs
updater.go
HasUpdate
func (u *Updater) HasUpdate() (bool, string) { return u.currentVersion.LessThan(u.latestVersion), u.latestVersion.String() }
go
func (u *Updater) HasUpdate() (bool, string) { return u.currentVersion.LessThan(u.latestVersion), u.latestVersion.String() }
[ "func", "(", "u", "*", "Updater", ")", "HasUpdate", "(", ")", "(", "bool", ",", "string", ")", "{", "return", "u", ".", "currentVersion", ".", "LessThan", "(", "u", ".", "latestVersion", ")", ",", "u", ".", "latestVersion", ".", "String", "(", ")", ...
// HasUpdate returns true if a new update is available // the second output parameter is the latest ,full, version
[ "HasUpdate", "returns", "true", "if", "a", "new", "update", "is", "available", "the", "second", "output", "parameter", "is", "the", "latest", "full", "version" ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/updater.go#L97-L99
147,514
kataras/go-fs
updater.go
Run
func (u *Updater) Run(setters ...optionSetter) bool { opt := &Options{Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr, Silent: false} // default options for _, setter := range setters { setter.Set(opt) } writef := func(s string, a ...interface{}) { if !opt.Silent { opt.Stdout.Write([]byte(fmt.Sprintf...
go
func (u *Updater) Run(setters ...optionSetter) bool { opt := &Options{Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr, Silent: false} // default options for _, setter := range setters { setter.Set(opt) } writef := func(s string, a ...interface{}) { if !opt.Silent { opt.Stdout.Write([]byte(fmt.Sprintf...
[ "func", "(", "u", "*", "Updater", ")", "Run", "(", "setters", "...", "optionSetter", ")", "bool", "{", "opt", ":=", "&", "Options", "{", "Stdin", ":", "os", ".", "Stdin", ",", "Stdout", ":", "os", ".", "Stdout", ",", "Stderr", ":", "os", ".", "St...
// Run runs the update, returns true if update has been found and installed, otherwise false
[ "Run", "runs", "the", "update", "returns", "true", "if", "update", "has", "been", "found", "and", "installed", "otherwise", "false" ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/updater.go#L107-L170
147,515
kataras/go-fs
updater.go
Stderr
func Stderr(val io.Writer) OptionSet { return func(o *Options) { o.Stderr = val } }
go
func Stderr(val io.Writer) OptionSet { return func(o *Options) { o.Stderr = val } }
[ "func", "Stderr", "(", "val", "io", ".", "Writer", ")", "OptionSet", "{", "return", "func", "(", "o", "*", "Options", ")", "{", "o", ".", "Stderr", "=", "val", "\n", "}", "\n", "}" ]
// Stderr specify the process's standard output and error. // // If Stdout and Stderr are the same writer, at most one // goroutine at a time will call Write.
[ "Stderr", "specify", "the", "process", "s", "standard", "output", "and", "error", ".", "If", "Stdout", "and", "Stderr", "are", "the", "same", "writer", "at", "most", "one", "goroutine", "at", "a", "time", "will", "call", "Write", "." ]
74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c
https://github.com/kataras/go-fs/blob/74ea2e29a8e1e629ed2eb8347424ee9ffb46a69c/updater.go#L273-L277
147,516
ttacon/builder
insertablebuffer.go
grow
func (b *Builder) grow(n int) int { m := b.Len() // If buffer is empty, reset to recover space. if m == 0 && b.off != 0 { b.Truncate(0) } if len(b.buf)+n > cap(b.buf) { var buf []byte if b.buf == nil && n <= len(b.bootstrap) { buf = b.bootstrap[0:] } else if m+n <= cap(b.buf)/2 { // We can slide thin...
go
func (b *Builder) grow(n int) int { m := b.Len() // If buffer is empty, reset to recover space. if m == 0 && b.off != 0 { b.Truncate(0) } if len(b.buf)+n > cap(b.buf) { var buf []byte if b.buf == nil && n <= len(b.bootstrap) { buf = b.bootstrap[0:] } else if m+n <= cap(b.buf)/2 { // We can slide thin...
[ "func", "(", "b", "*", "Builder", ")", "grow", "(", "n", "int", ")", "int", "{", "m", ":=", "b", ".", "Len", "(", ")", "\n", "// If buffer is empty, reset to recover space.", "if", "m", "==", "0", "&&", "b", ".", "off", "!=", "0", "{", "b", ".", ...
// grow grows the buffer to guarantee space for n more bytes. // It returns the index where bytes should be written. // If the buffer can't grow it will panic with ErrTooLarge.
[ "grow", "grows", "the", "buffer", "to", "guarantee", "space", "for", "n", "more", "bytes", ".", "It", "returns", "the", "index", "where", "bytes", "should", "be", "written", ".", "If", "the", "buffer", "can", "t", "grow", "it", "will", "panic", "with", ...
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L84-L111
147,517
ttacon/builder
insertablebuffer.go
Write
func (b *Builder) Write(p []byte) (n int, err error) { b.lastRead = opInvalid m := b.grow(len(p)) return copy(b.buf[m:], p), nil }
go
func (b *Builder) Write(p []byte) (n int, err error) { b.lastRead = opInvalid m := b.grow(len(p)) return copy(b.buf[m:], p), nil }
[ "func", "(", "b", "*", "Builder", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "b", ".", "lastRead", "=", "opInvalid", "\n", "m", ":=", "b", ".", "grow", "(", "len", "(", "p", ")", ")", "\n"...
// Write appends the contents of p to the buffer, growing the buffer as // needed. The return value n is the length of p; err is always nil. If the // buffer becomes too large, Write will panic with ErrTooLarge.
[ "Write", "appends", "the", "contents", "of", "p", "to", "the", "buffer", "growing", "the", "buffer", "as", "needed", ".", "The", "return", "value", "n", "is", "the", "length", "of", "p", ";", "err", "is", "always", "nil", ".", "If", "the", "buffer", ...
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L129-L133
147,518
ttacon/builder
insertablebuffer.go
WriteByte
func (b *Builder) WriteByte(c byte) error { b.lastRead = opInvalid m := b.grow(1) b.buf[m] = c return nil }
go
func (b *Builder) WriteByte(c byte) error { b.lastRead = opInvalid m := b.grow(1) b.buf[m] = c return nil }
[ "func", "(", "b", "*", "Builder", ")", "WriteByte", "(", "c", "byte", ")", "error", "{", "b", ".", "lastRead", "=", "opInvalid", "\n", "m", ":=", "b", ".", "grow", "(", "1", ")", "\n", "b", ".", "buf", "[", "m", "]", "=", "c", "\n", "return",...
// WriteByte appends the byte c to the buffer, growing the buffer as needed. // The returned error is always nil, but is included to match bufio.Writer's // WriteByte. If the buffer becomes too large, WriteByte will panic with // ErrTooLarge.
[ "WriteByte", "appends", "the", "byte", "c", "to", "the", "buffer", "growing", "the", "buffer", "as", "needed", ".", "The", "returned", "error", "is", "always", "nil", "but", "is", "included", "to", "match", "bufio", ".", "Writer", "s", "WriteByte", ".", ...
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L224-L229
147,519
ttacon/builder
insertablebuffer.go
WriteRune
func (b *Builder) WriteRune(r rune) (n int, err error) { if r < utf8.RuneSelf { b.WriteByte(byte(r)) return 1, nil } n = utf8.EncodeRune(b.runeBytes[0:], r) b.Write(b.runeBytes[0:n]) return n, nil }
go
func (b *Builder) WriteRune(r rune) (n int, err error) { if r < utf8.RuneSelf { b.WriteByte(byte(r)) return 1, nil } n = utf8.EncodeRune(b.runeBytes[0:], r) b.Write(b.runeBytes[0:n]) return n, nil }
[ "func", "(", "b", "*", "Builder", ")", "WriteRune", "(", "r", "rune", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "r", "<", "utf8", ".", "RuneSelf", "{", "b", ".", "WriteByte", "(", "byte", "(", "r", ")", ")", "\n", "return", "...
// WriteRune appends the UTF-8 encoding of Unicode code point r to the // buffer, returning its length and an error, which is always nil but is // included to match bufio.Writer's WriteRune. The buffer is grown as needed; // if it becomes too large, WriteRune will panic with ErrTooLarge.
[ "WriteRune", "appends", "the", "UTF", "-", "8", "encoding", "of", "Unicode", "code", "point", "r", "to", "the", "buffer", "returning", "its", "length", "and", "an", "error", "which", "is", "always", "nil", "but", "is", "included", "to", "match", "bufio", ...
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L235-L243
147,520
ttacon/builder
insertablebuffer.go
ReadRune
func (b *Builder) ReadRune() (r rune, size int, err error) { b.lastRead = opInvalid if b.off >= len(b.buf) { // Buffer is empty, reset to recover space. b.Truncate(0) return 0, 0, io.EOF } b.lastRead = opReadRune c := b.buf[b.off] if c < utf8.RuneSelf { b.off++ return rune(c), 1, nil } r, n := utf8.De...
go
func (b *Builder) ReadRune() (r rune, size int, err error) { b.lastRead = opInvalid if b.off >= len(b.buf) { // Buffer is empty, reset to recover space. b.Truncate(0) return 0, 0, io.EOF } b.lastRead = opReadRune c := b.buf[b.off] if c < utf8.RuneSelf { b.off++ return rune(c), 1, nil } r, n := utf8.De...
[ "func", "(", "b", "*", "Builder", ")", "ReadRune", "(", ")", "(", "r", "rune", ",", "size", "int", ",", "err", "error", ")", "{", "b", ".", "lastRead", "=", "opInvalid", "\n", "if", "b", ".", "off", ">=", "len", "(", "b", ".", "buf", ")", "{"...
// ReadRune reads and returns the next UTF-8-encoded // Unicode code point from the buffer. // If no bytes are available, the error returned is io.EOF. // If the bytes are an erroneous UTF-8 encoding, it // consumes one byte and returns U+FFFD, 1.
[ "ReadRune", "reads", "and", "returns", "the", "next", "UTF", "-", "8", "-", "encoded", "Unicode", "code", "point", "from", "the", "buffer", ".", "If", "no", "bytes", "are", "available", "the", "error", "returned", "is", "io", ".", "EOF", ".", "If", "th...
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L305-L321
147,521
ttacon/builder
insertablebuffer.go
UnreadByte
func (b *Builder) UnreadByte() error { if b.lastRead != opReadRune && b.lastRead != opRead { return errors.New("bytes.Buffer: UnreadByte: previous operation was not a read") } b.lastRead = opInvalid if b.off > 0 { b.off-- } return nil }
go
func (b *Builder) UnreadByte() error { if b.lastRead != opReadRune && b.lastRead != opRead { return errors.New("bytes.Buffer: UnreadByte: previous operation was not a read") } b.lastRead = opInvalid if b.off > 0 { b.off-- } return nil }
[ "func", "(", "b", "*", "Builder", ")", "UnreadByte", "(", ")", "error", "{", "if", "b", ".", "lastRead", "!=", "opReadRune", "&&", "b", ".", "lastRead", "!=", "opRead", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "...
// UnreadByte unreads the last byte returned by the most recent // read operation. If write has happened since the last read, UnreadByte // returns an error.
[ "UnreadByte", "unreads", "the", "last", "byte", "returned", "by", "the", "most", "recent", "read", "operation", ".", "If", "write", "has", "happened", "since", "the", "last", "read", "UnreadByte", "returns", "an", "error", "." ]
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L343-L352
147,522
ttacon/builder
insertablebuffer.go
readSlice
func (b *Builder) readSlice(delim byte) (line []byte, err error) { i := bytes.IndexByte(b.buf[b.off:], delim) end := b.off + i + 1 if i < 0 { end = len(b.buf) err = io.EOF } line = b.buf[b.off:end] b.off = end b.lastRead = opRead return line, err }
go
func (b *Builder) readSlice(delim byte) (line []byte, err error) { i := bytes.IndexByte(b.buf[b.off:], delim) end := b.off + i + 1 if i < 0 { end = len(b.buf) err = io.EOF } line = b.buf[b.off:end] b.off = end b.lastRead = opRead return line, err }
[ "func", "(", "b", "*", "Builder", ")", "readSlice", "(", "delim", "byte", ")", "(", "line", "[", "]", "byte", ",", "err", "error", ")", "{", "i", ":=", "bytes", ".", "IndexByte", "(", "b", ".", "buf", "[", "b", ".", "off", ":", "]", ",", "del...
// readSlice is like ReadBytes but returns a reference to internal buffer data.
[ "readSlice", "is", "like", "ReadBytes", "but", "returns", "a", "reference", "to", "internal", "buffer", "data", "." ]
c099f663e1c235176c175644792c5eb282017ad7
https://github.com/ttacon/builder/blob/c099f663e1c235176c175644792c5eb282017ad7/insertablebuffer.go#L369-L380
147,523
jen20/awspolicyequivalence
aws_policy_equivalence.go
PoliciesAreEquivalent
func PoliciesAreEquivalent(policy1, policy2 string) (bool, error) { policy1intermediate := &intermediateAwsPolicyDocument{} if err := json.Unmarshal([]byte(policy1), policy1intermediate); err != nil { return false, fmt.Errorf("Error unmarshaling policy: %s", err) } policy2intermediate := &intermediateAwsPolicyDo...
go
func PoliciesAreEquivalent(policy1, policy2 string) (bool, error) { policy1intermediate := &intermediateAwsPolicyDocument{} if err := json.Unmarshal([]byte(policy1), policy1intermediate); err != nil { return false, fmt.Errorf("Error unmarshaling policy: %s", err) } policy2intermediate := &intermediateAwsPolicyDo...
[ "func", "PoliciesAreEquivalent", "(", "policy1", ",", "policy2", "string", ")", "(", "bool", ",", "error", ")", "{", "policy1intermediate", ":=", "&", "intermediateAwsPolicyDocument", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "[", "]"...
// PoliciesAreEquivalent tests for the structural equivalence of two // AWS policies. It does not read into the semantics, other than treating // single element string arrays as equivalent to a string without an // array, as the AWS endpoints do. // // It will, however, detect reordering and ignore whitespace. // // Re...
[ "PoliciesAreEquivalent", "tests", "for", "the", "structural", "equivalence", "of", "two", "AWS", "policies", ".", "It", "does", "not", "read", "into", "the", "semantics", "other", "than", "treating", "single", "element", "string", "arrays", "as", "equivalent", "...
9ebbf3c225b2b9da629263e13c3015a5de7965d1
https://github.com/jen20/awspolicyequivalence/blob/9ebbf3c225b2b9da629263e13c3015a5de7965d1/aws_policy_equivalence.go#L30-L51
147,524
whyrusleeping/tar-utils
extractor.go
outputPath
func (te *Extractor) outputPath(tarPath string) (outPath string, err error) { elems := strings.Split(tarPath, "/") // break into elems elems = elems[1:] // remove original root outPath = strings.Join(elems, "/") // join elems outPath = gopath.Join(te.Path, outPath) // rebase on to extr...
go
func (te *Extractor) outputPath(tarPath string) (outPath string, err error) { elems := strings.Split(tarPath, "/") // break into elems elems = elems[1:] // remove original root outPath = strings.Join(elems, "/") // join elems outPath = gopath.Join(te.Path, outPath) // rebase on to extr...
[ "func", "(", "te", "*", "Extractor", ")", "outputPath", "(", "tarPath", "string", ")", "(", "outPath", "string", ",", "err", "error", ")", "{", "elems", ":=", "strings", ".", "Split", "(", "tarPath", ",", "\"", "\"", ")", "// break into elems", "\n", "...
// outputPath returns the path at which to place tarPath
[ "outputPath", "returns", "the", "path", "at", "which", "to", "place", "tarPath" ]
8c6c8ba81d5c71fd69c0f48dbde4b2fb422b6dfc
https://github.com/whyrusleeping/tar-utils/blob/8c6c8ba81d5c71fd69c0f48dbde4b2fb422b6dfc/extractor.go#L106-L118
147,525
whyrusleeping/tar-utils
extractor.go
childrenOnly
func childrenOnly(inLink Link) error { if fp.IsAbs(inLink.Target) { return fmt.Errorf("Link target %q is an absolute path (forbidden)", inLink.Target) } resolvedTarget := fp.Join(inLink.Name, inLink.Target) rel, err := fp.Rel(inLink.Root, resolvedTarget) if err != nil { return err } //disallow symlinks from...
go
func childrenOnly(inLink Link) error { if fp.IsAbs(inLink.Target) { return fmt.Errorf("Link target %q is an absolute path (forbidden)", inLink.Target) } resolvedTarget := fp.Join(inLink.Name, inLink.Target) rel, err := fp.Rel(inLink.Root, resolvedTarget) if err != nil { return err } //disallow symlinks from...
[ "func", "childrenOnly", "(", "inLink", "Link", ")", "error", "{", "if", "fp", ".", "IsAbs", "(", "inLink", ".", "Target", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "inLink", ".", "Target", ")", "\n", "}", "\n\n", "resolvedTarget...
// childrenOnly will return an error if link targets escape their root
[ "childrenOnly", "will", "return", "an", "error", "if", "link", "targets", "escape", "their", "root" ]
8c6c8ba81d5c71fd69c0f48dbde4b2fb422b6dfc
https://github.com/whyrusleeping/tar-utils/blob/8c6c8ba81d5c71fd69c0f48dbde4b2fb422b6dfc/extractor.go#L197-L217
147,526
nwidger/jsoncolor
jsoncolor.go
NewFormatter
func NewFormatter() *Formatter { return &Formatter{ SpaceColor: DefaultSpaceColor, CommaColor: DefaultCommaColor, ColonColor: DefaultColonColor, ObjectColor: DefaultObjectColor, ArrayColor: DefaultArrayColor, FieldQuoteColor: DefaultFieldQuoteColor, FieldColor: Default...
go
func NewFormatter() *Formatter { return &Formatter{ SpaceColor: DefaultSpaceColor, CommaColor: DefaultCommaColor, ColonColor: DefaultColonColor, ObjectColor: DefaultObjectColor, ArrayColor: DefaultArrayColor, FieldQuoteColor: DefaultFieldQuoteColor, FieldColor: Default...
[ "func", "NewFormatter", "(", ")", "*", "Formatter", "{", "return", "&", "Formatter", "{", "SpaceColor", ":", "DefaultSpaceColor", ",", "CommaColor", ":", "DefaultCommaColor", ",", "ColonColor", ":", "DefaultColonColor", ",", "ObjectColor", ":", "DefaultObjectColor",...
// NewFormatter returns a new formatter.
[ "NewFormatter", "returns", "a", "new", "formatter", "." ]
75a6de4340e59be95f0884b9cebdda246e0fdf40
https://github.com/nwidger/jsoncolor/blob/75a6de4340e59be95f0884b9cebdda246e0fdf40/jsoncolor.go#L164-L182
147,527
nwidger/jsoncolor
jsoncolor.go
Format
func (f *Formatter) Format(dst io.Writer, src []byte) error { return newFormatterState(f, dst).format(dst, src) }
go
func (f *Formatter) Format(dst io.Writer, src []byte) error { return newFormatterState(f, dst).format(dst, src) }
[ "func", "(", "f", "*", "Formatter", ")", "Format", "(", "dst", "io", ".", "Writer", ",", "src", "[", "]", "byte", ")", "error", "{", "return", "newFormatterState", "(", "f", ",", "dst", ")", ".", "format", "(", "dst", ",", "src", ")", "\n", "}" ]
// Format appends to dst a colorized form of the JSON-encoded src.
[ "Format", "appends", "to", "dst", "a", "colorized", "form", "of", "the", "JSON", "-", "encoded", "src", "." ]
75a6de4340e59be95f0884b9cebdda246e0fdf40
https://github.com/nwidger/jsoncolor/blob/75a6de4340e59be95f0884b9cebdda246e0fdf40/jsoncolor.go#L185-L187
147,528
Songmu/strrand
strrand.go
Generate
func (sr *Strrand) Generate(pattern string) (string, error) { result := "" g, err := sr.CreateGenerator(pattern) if err != nil { return result, err } return g.Generate(), nil }
go
func (sr *Strrand) Generate(pattern string) (string, error) { result := "" g, err := sr.CreateGenerator(pattern) if err != nil { return result, err } return g.Generate(), nil }
[ "func", "(", "sr", "*", "Strrand", ")", "Generate", "(", "pattern", "string", ")", "(", "string", ",", "error", ")", "{", "result", ":=", "\"", "\"", "\n", "g", ",", "err", ":=", "sr", ".", "CreateGenerator", "(", "pattern", ")", "\n", "if", "err",...
// Generate generates random string
[ "Generate", "generates", "random", "string" ]
5195340ba52ce1bb6918091f054e4c8fdc645c41
https://github.com/Songmu/strrand/blob/5195340ba52ce1bb6918091f054e4c8fdc645c41/strrand.go#L130-L137
147,529
Songmu/strrand
strrand.go
CreateGenerator
func (sr *Strrand) CreateGenerator(pattern string) (Generator, error) { pis := pickers([]picker{}) chars := func() *[]string { c := strings.Split(pattern, "") return &c }() for len(*chars) > 0 { chr := (*chars)[0] *chars = (*chars)[1:] switch chr { case "\\": p, err := sr.handleEscape(chars) if ...
go
func (sr *Strrand) CreateGenerator(pattern string) (Generator, error) { pis := pickers([]picker{}) chars := func() *[]string { c := strings.Split(pattern, "") return &c }() for len(*chars) > 0 { chr := (*chars)[0] *chars = (*chars)[1:] switch chr { case "\\": p, err := sr.handleEscape(chars) if ...
[ "func", "(", "sr", "*", "Strrand", ")", "CreateGenerator", "(", "pattern", "string", ")", "(", "Generator", ",", "error", ")", "{", "pis", ":=", "pickers", "(", "[", "]", "picker", "{", "}", ")", "\n", "chars", ":=", "func", "(", ")", "*", "[", "...
// CreateGenerator returns random string generator
[ "CreateGenerator", "returns", "random", "string", "generator" ]
5195340ba52ce1bb6918091f054e4c8fdc645c41
https://github.com/Songmu/strrand/blob/5195340ba52ce1bb6918091f054e4c8fdc645c41/strrand.go#L140-L188
147,530
vanng822/css
parser.go
Parse
func Parse(csstext string) *CSSStyleSheet { context := &parserContext{ State: STATE_NONE, NowSelectorText: "", NowRuleType: STYLE_RULE, CurrentNestedRule: nil, } css := &CSSStyleSheet{} css.CssRuleList = make([]*CSSRule, 0) s := scanner.New(csstext) for { token := s.Next() if to...
go
func Parse(csstext string) *CSSStyleSheet { context := &parserContext{ State: STATE_NONE, NowSelectorText: "", NowRuleType: STYLE_RULE, CurrentNestedRule: nil, } css := &CSSStyleSheet{} css.CssRuleList = make([]*CSSRule, 0) s := scanner.New(csstext) for { token := s.Next() if to...
[ "func", "Parse", "(", "csstext", "string", ")", "*", "CSSStyleSheet", "{", "context", ":=", "&", "parserContext", "{", "State", ":", "STATE_NONE", ",", "NowSelectorText", ":", "\"", "\"", ",", "NowRuleType", ":", "STYLE_RULE", ",", "CurrentNestedRule", ":", ...
// Parse takes a string of valid css rules, stylesheet, // and parses it. Be aware this function has poor error handling // so you should have valid syntax in your css
[ "Parse", "takes", "a", "string", "of", "valid", "css", "rules", "stylesheet", "and", "parses", "it", ".", "Be", "aware", "this", "function", "has", "poor", "error", "handling", "so", "you", "should", "have", "valid", "syntax", "in", "your", "css" ]
630d8a6dd375098a1675f2022c1c8ce2dbc10dcd
https://github.com/vanng822/css/blob/630d8a6dd375098a1675f2022c1c8ce2dbc10dcd/parser.go#L68-L164
147,531
vanng822/css
block_parser.go
ParseBlock
func ParseBlock(csstext string) []*CSSStyleDeclaration { s := scanner.New(csstext) return parseBlock(s) }
go
func ParseBlock(csstext string) []*CSSStyleDeclaration { s := scanner.New(csstext) return parseBlock(s) }
[ "func", "ParseBlock", "(", "csstext", "string", ")", "[", "]", "*", "CSSStyleDeclaration", "{", "s", ":=", "scanner", ".", "New", "(", "csstext", ")", "\n", "return", "parseBlock", "(", "s", ")", "\n", "}" ]
// ParseBlock take a string of a css block, // parses it and returns a map of css style declarations.
[ "ParseBlock", "take", "a", "string", "of", "a", "css", "block", "parses", "it", "and", "returns", "a", "map", "of", "css", "style", "declarations", "." ]
630d8a6dd375098a1675f2022c1c8ce2dbc10dcd
https://github.com/vanng822/css/blob/630d8a6dd375098a1675f2022c1c8ce2dbc10dcd/block_parser.go#L18-L21
147,532
mohae/joefriday
cpu/cpufreq/flat/cpufreq_unix.go
Get
func Get() (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
go
func Get() (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
[ "func", "Get", "(", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{", "std", ",", "err", "=", "NewProfiler", "...
// Get returns the Frequency as Flatbuffer serialized bytes using the package's // global profiler.
[ "Get", "returns", "the", "Frequency", "as", "Flatbuffer", "serialized", "bytes", "using", "the", "package", "s", "global", "profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpufreq/flat/cpufreq_unix.go#L63-L73
147,533
mohae/joefriday
cpu/cpufreq/flat/cpufreq_unix.go
Serialize
func (p *Profiler) Serialize(f *freq.Frequency) []byte { // ensure the Builder is in a usable state. p.Builder.Reset() uoffs := make([]fb.UOffsetT, len(f.CPU)) for i, cpu := range f.CPU { uoffs[i] = p.SerializeCPU(&cpu) } structs.FrequencyStartCPUVector(p.Builder, len(uoffs)) for i := len(uoffs) - 1; i >= 0; i...
go
func (p *Profiler) Serialize(f *freq.Frequency) []byte { // ensure the Builder is in a usable state. p.Builder.Reset() uoffs := make([]fb.UOffsetT, len(f.CPU)) for i, cpu := range f.CPU { uoffs[i] = p.SerializeCPU(&cpu) } structs.FrequencyStartCPUVector(p.Builder, len(uoffs)) for i := len(uoffs) - 1; i >= 0; i...
[ "func", "(", "p", "*", "Profiler", ")", "Serialize", "(", "f", "*", "freq", ".", "Frequency", ")", "[", "]", "byte", "{", "// ensure the Builder is in a usable state.", "p", ".", "Builder", ".", "Reset", "(", ")", "\n", "uoffs", ":=", "make", "(", "[", ...
// Serialize serializes Frequency using Flatbuffers.
[ "Serialize", "serializes", "Frequency", "using", "Flatbuffers", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpufreq/flat/cpufreq_unix.go#L76-L98
147,534
mohae/joefriday
cpu/cpufreq/flat/cpufreq_unix.go
Serialize
func Serialize(f *freq.Frequency) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(f), nil }
go
func Serialize(f *freq.Frequency) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(f), nil }
[ "func", "Serialize", "(", "f", "*", "freq", ".", "Frequency", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{", ...
// Serialize cpufreq.Frequency using the package global profiler.
[ "Serialize", "cpufreq", ".", "Frequency", "using", "the", "package", "global", "profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpufreq/flat/cpufreq_unix.go#L113-L123
147,535
mohae/joefriday
cpu/cpufreq/flat/cpufreq_unix.go
Deserialize
func Deserialize(p []byte) *freq.Frequency { ff := structs.GetRootAsFrequency(p, 0) l := ff.CPULength() f := &freq.Frequency{} fCPU := &structs.CPU{} cpu := freq.CPU{} f.Timestamp = ff.Timestamp() f.Sockets = ff.Sockets() for i := 0; i < l; i++ { if !ff.CPU(fCPU, i) { continue } cpu.Processor = fCPU.Pr...
go
func Deserialize(p []byte) *freq.Frequency { ff := structs.GetRootAsFrequency(p, 0) l := ff.CPULength() f := &freq.Frequency{} fCPU := &structs.CPU{} cpu := freq.CPU{} f.Timestamp = ff.Timestamp() f.Sockets = ff.Sockets() for i := 0; i < l; i++ { if !ff.CPU(fCPU, i) { continue } cpu.Processor = fCPU.Pr...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "freq", ".", "Frequency", "{", "ff", ":=", "structs", ".", "GetRootAsFrequency", "(", "p", ",", "0", ")", "\n", "l", ":=", "ff", ".", "CPULength", "(", ")", "\n", "f", ":=", "&", "freq"...
// Deserialize takes some Flatbuffer serialized bytes and deserializes them // as cpufreq.Frequency.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserializes", "them", "as", "cpufreq", ".", "Frequency", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpufreq/flat/cpufreq_unix.go#L127-L147
147,536
mohae/joefriday
system/os/flat/os_unix.go
Serialize
func (prof *Profiler) Serialize(os *o.OS) []byte { // ensure the Builder is in a usable state. prof.Builder.Reset() name := prof.Builder.CreateString(os.Name) id := prof.Builder.CreateString(os.ID) idLike := prof.Builder.CreateString(os.IDLike) prettyName := prof.Builder.CreateString(os.PrettyName) version := pr...
go
func (prof *Profiler) Serialize(os *o.OS) []byte { // ensure the Builder is in a usable state. prof.Builder.Reset() name := prof.Builder.CreateString(os.Name) id := prof.Builder.CreateString(os.ID) idLike := prof.Builder.CreateString(os.IDLike) prettyName := prof.Builder.CreateString(os.PrettyName) version := pr...
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "os", "*", "o", ".", "OS", ")", "[", "]", "byte", "{", "// ensure the Builder is in a usable state.", "prof", ".", "Builder", ".", "Reset", "(", ")", "\n", "name", ":=", "prof", ".", "Builder",...
// Serialize serializes OS release information as Flatbuffers.
[ "Serialize", "serializes", "OS", "release", "information", "as", "Flatbuffers", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/os/flat/os_unix.go#L74-L100
147,537
mohae/joefriday
system/os/flat/os_unix.go
Deserialize
func Deserialize(p []byte) *o.OS { flatOS := structs.GetRootAsOS(p, 0) var os o.OS os.Name = string(flatOS.Name()) os.ID = string(flatOS.ID()) os.IDLike = string(flatOS.IDLike()) os.HomeURL = string(flatOS.HomeURL()) os.PrettyName = string(flatOS.PrettyName()) os.Version = string(flatOS.Version()) os.VersionID...
go
func Deserialize(p []byte) *o.OS { flatOS := structs.GetRootAsOS(p, 0) var os o.OS os.Name = string(flatOS.Name()) os.ID = string(flatOS.ID()) os.IDLike = string(flatOS.IDLike()) os.HomeURL = string(flatOS.HomeURL()) os.PrettyName = string(flatOS.PrettyName()) os.Version = string(flatOS.Version()) os.VersionID...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "o", ".", "OS", "{", "flatOS", ":=", "structs", ".", "GetRootAsOS", "(", "p", ",", "0", ")", "\n", "var", "os", "o", ".", "OS", "\n", "os", ".", "Name", "=", "string", "(", "flatOS", ...
// Deserialize takes some Flatbuffer serialized bytes and deserializes them // as release.OS.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserializes", "them", "as", "release", ".", "OS", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/os/flat/os_unix.go#L118-L130
147,538
mohae/joefriday
net/netdev/netdev_unix.go
Get
func Get() (inf *structs.DevInfo, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
go
func Get() (inf *structs.DevInfo, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
[ "func", "Get", "(", ")", "(", "inf", "*", "structs", ".", "DevInfo", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{", "std", ",", "err", "=", ...
// Get returns the current network device information using the package's // global Profiler.
[ "Get", "returns", "the", "current", "network", "device", "information", "using", "the", "package", "s", "global", "Profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/net/netdev/netdev_unix.go#L190-L200
147,539
mohae/joefriday
net/netdev/netdev_unix.go
NewTicker
func NewTicker(d time.Duration) (joe.Tocker, error) { p, err := NewProfiler() if err != nil { return nil, err } t := Ticker{Ticker: joe.NewTicker(d), Data: make(chan *structs.DevInfo), Profiler: p} go t.Run() return &t, nil }
go
func NewTicker(d time.Duration) (joe.Tocker, error) { p, err := NewProfiler() if err != nil { return nil, err } t := Ticker{Ticker: joe.NewTicker(d), Data: make(chan *structs.DevInfo), Profiler: p} go t.Run() return &t, nil }
[ "func", "NewTicker", "(", "d", "time", ".", "Duration", ")", "(", "joe", ".", "Tocker", ",", "error", ")", "{", "p", ",", "err", ":=", "NewProfiler", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "...
// NewTicker returns a new Ticker containing a Data channel that delivers the // data at intervals and an error channel that delivers any errors encountered. // Stop the ticker to signal the ticker to stop running. Stopping the ticker // does not close the Data channel; call Close to close both the ticker and the // da...
[ "NewTicker", "returns", "a", "new", "Ticker", "containing", "a", "Data", "channel", "that", "delivers", "the", "data", "at", "intervals", "and", "an", "error", "channel", "that", "delivers", "any", "errors", "encountered", ".", "Stop", "the", "ticker", "to", ...
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/net/netdev/netdev_unix.go#L214-L222
147,540
mohae/joefriday
mem/membasic/flat/membasic_unix.go
Serialize
func (prof *Profiler) Serialize(inf *basic.Info) []byte { // ensure the Builder is in a usable state. prof.Builder.Reset() structs.InfoStart(prof.Builder) structs.InfoAddTimestamp(prof.Builder, inf.Timestamp) structs.InfoAddActive(prof.Builder, inf.Active) structs.InfoAddInactive(prof.Builder, inf.Inactive) stru...
go
func (prof *Profiler) Serialize(inf *basic.Info) []byte { // ensure the Builder is in a usable state. prof.Builder.Reset() structs.InfoStart(prof.Builder) structs.InfoAddTimestamp(prof.Builder, inf.Timestamp) structs.InfoAddActive(prof.Builder, inf.Active) structs.InfoAddInactive(prof.Builder, inf.Inactive) stru...
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "inf", "*", "basic", ".", "Info", ")", "[", "]", "byte", "{", "// ensure the Builder is in a usable state.", "prof", ".", "Builder", ".", "Reset", "(", ")", "\n", "structs", ".", "InfoStart", "("...
// Serialize the basic memory information using Flatbuffers.
[ "Serialize", "the", "basic", "memory", "information", "using", "Flatbuffers", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/mem/membasic/flat/membasic_unix.go#L80-L100
147,541
mohae/joefriday
mem/membasic/flat/membasic_unix.go
Deserialize
func Deserialize(p []byte) *basic.Info { infoFlat := structs.GetRootAsInfo(p, 0) info := &basic.Info{} info.Timestamp = infoFlat.Timestamp() info.Active = infoFlat.Active() info.Inactive = infoFlat.Inactive() info.Mapped = infoFlat.Mapped() info.MemAvailable = infoFlat.MemAvailable() info.MemFree = infoFlat.Mem...
go
func Deserialize(p []byte) *basic.Info { infoFlat := structs.GetRootAsInfo(p, 0) info := &basic.Info{} info.Timestamp = infoFlat.Timestamp() info.Active = infoFlat.Active() info.Inactive = infoFlat.Inactive() info.Mapped = infoFlat.Mapped() info.MemAvailable = infoFlat.MemAvailable() info.MemFree = infoFlat.Mem...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "basic", ".", "Info", "{", "infoFlat", ":=", "structs", ".", "GetRootAsInfo", "(", "p", ",", "0", ")", "\n", "info", ":=", "&", "basic", ".", "Info", "{", "}", "\n", "info", ".", "Times...
// Deserialize takes some Flatbuffer serialized bytes and deserializes them // as membasic.Info.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserializes", "them", "as", "membasic", ".", "Info", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/mem/membasic/flat/membasic_unix.go#L118-L132
147,542
mohae/joefriday
disk/diskstats/json/diskstats_unix.go
Serialize
func (prof *Profiler) Serialize(st *structs.DiskStats) ([]byte, error) { return json.Marshal(st) }
go
func (prof *Profiler) Serialize(st *structs.DiskStats) ([]byte, error) { return json.Marshal(st) }
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "st", "*", "structs", ".", "DiskStats", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "st", ")", "\n", "}" ]
// Serialize structs.DiskStats using JSON.
[ "Serialize", "structs", ".", "DiskStats", "using", "JSON", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/disk/diskstats/json/diskstats_unix.go#L75-L77
147,543
mohae/joefriday
disk/diskstats/json/diskstats_unix.go
Serialize
func Serialize(st *structs.DiskStats) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(st) }
go
func Serialize(st *structs.DiskStats) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(st) }
[ "func", "Serialize", "(", "st", "*", "structs", ".", "DiskStats", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "...
// Serialize structs.DiskStats using JSON with the package's global Profiler.
[ "Serialize", "structs", ".", "DiskStats", "using", "JSON", "with", "the", "package", "s", "global", "Profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/disk/diskstats/json/diskstats_unix.go#L80-L90
147,544
mohae/joefriday
disk/diskstats/json/diskstats_unix.go
Deserialize
func Deserialize(p []byte) (*structs.DiskStats, error) { st := &structs.DiskStats{} err := json.Unmarshal(p, st) if err != nil { return nil, err } return st, nil }
go
func Deserialize(p []byte) (*structs.DiskStats, error) { st := &structs.DiskStats{} err := json.Unmarshal(p, st) if err != nil { return nil, err } return st, nil }
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "(", "*", "structs", ".", "DiskStats", ",", "error", ")", "{", "st", ":=", "&", "structs", ".", "DiskStats", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "p", ",", "st", ")", ...
// Deserialize takes some JSON serialized bytes and unmarshals them as // structs.DiskStats.
[ "Deserialize", "takes", "some", "JSON", "serialized", "bytes", "and", "unmarshals", "them", "as", "structs", ".", "DiskStats", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/disk/diskstats/json/diskstats_unix.go#L104-L111
147,545
4ydx/gltext
truetype.go
GetGlyphIndex
func (rr RuneRanges) GetGlyphIndex(char rune) rune { var index, offset rune index = -1 for _, runes := range rr { if char >= runes.Low && char <= runes.High { index = char - runes.Low + offset } offset += runes.High - runes.Low + 1 } return index }
go
func (rr RuneRanges) GetGlyphIndex(char rune) rune { var index, offset rune index = -1 for _, runes := range rr { if char >= runes.Low && char <= runes.High { index = char - runes.Low + offset } offset += runes.High - runes.Low + 1 } return index }
[ "func", "(", "rr", "RuneRanges", ")", "GetGlyphIndex", "(", "char", "rune", ")", "rune", "{", "var", "index", ",", "offset", "rune", "\n", "index", "=", "-", "1", "\n", "for", "_", ",", "runes", ":=", "range", "rr", "{", "if", "char", ">=", "runes"...
// GetGlyphIndex returns the location of the glyph data within // the compressed rune ranges covered by the font // EG if runes 0-25, 100-110 are supported by the font then // the actual location of 100 will be in position 26 in the png image
[ "GetGlyphIndex", "returns", "the", "location", "of", "the", "glyph", "data", "within", "the", "compressed", "rune", "ranges", "covered", "by", "the", "font", "EG", "if", "runes", "0", "-", "25", "100", "-", "110", "are", "supported", "by", "the", "font", ...
84bc6aa204bffadd70a6fa2f0f267e6c4d82835e
https://github.com/4ydx/gltext/blob/84bc6aa204bffadd70a6fa2f0f267e6c4d82835e/truetype.go#L51-L61
147,546
mohae/joefriday
system/os/json/os_unix.go
Serialize
func (prof *Profiler) Serialize(os *o.OS) ([]byte, error) { return json.Marshal(os) }
go
func (prof *Profiler) Serialize(os *o.OS) ([]byte, error) { return json.Marshal(os) }
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "os", "*", "o", ".", "OS", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "os", ")", "\n", "}" ]
// Serialize os.OS as JSON
[ "Serialize", "os", ".", "OS", "as", "JSON" ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/os/json/os_unix.go#L72-L74
147,547
mohae/joefriday
system/os/json/os_unix.go
Serialize
func Serialize(os *o.OS) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(os) }
go
func Serialize(os *o.OS) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(os) }
[ "func", "Serialize", "(", "os", "*", "o", ".", "OS", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{", "std", ...
// Serialize os.OS as JSON using the package's global Profiler.
[ "Serialize", "os", ".", "OS", "as", "JSON", "using", "the", "package", "s", "global", "Profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/os/json/os_unix.go#L77-L87
147,548
mohae/joefriday
system/os/json/os_unix.go
Deserialize
func Deserialize(p []byte) (*o.OS, error) { os := &o.OS{} err := json.Unmarshal(p, os) if err != nil { return nil, err } return os, nil }
go
func Deserialize(p []byte) (*o.OS, error) { os := &o.OS{} err := json.Unmarshal(p, os) if err != nil { return nil, err } return os, nil }
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "(", "*", "o", ".", "OS", ",", "error", ")", "{", "os", ":=", "&", "o", ".", "OS", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "p", ",", "os", ")", "\n", "if", "err", ...
// Deserialize takes some JSON serialized bytes and unmarshals them as os.OS.
[ "Deserialize", "takes", "some", "JSON", "serialized", "bytes", "and", "unmarshals", "them", "as", "os", ".", "OS", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/os/json/os_unix.go#L100-L107
147,549
mohae/joefriday
sysinfo/mem/flat/mem_unix.go
Get
func Get() (p []byte, err error) { var inf m.MemInfo err = inf.Get() if err != nil { return nil, err } return Serialize(&inf), nil }
go
func Get() (p []byte, err error) { var inf m.MemInfo err = inf.Get() if err != nil { return nil, err } return Serialize(&inf), nil }
[ "func", "Get", "(", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "var", "inf", "m", ".", "MemInfo", "\n", "err", "=", "inf", ".", "Get", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}...
// Get gets the system's memory informatin as Flatbuffer serialized bytes.
[ "Get", "gets", "the", "system", "s", "memory", "informatin", "as", "Flatbuffer", "serialized", "bytes", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/mem/flat/mem_unix.go#L37-L44
147,550
mohae/joefriday
sysinfo/mem/flat/mem_unix.go
Serialize
func Serialize(inf *m.MemInfo) []byte { mu.Lock() defer mu.Unlock() // ensure the Builder is in a usable state. builder.Reset() structs.MemInfoStart(builder) structs.MemInfoAddTimestamp(builder, inf.Timestamp) structs.MemInfoAddTotalRAM(builder, inf.TotalRAM) structs.MemInfoAddFreeRAM(builder, inf.FreeRAM) str...
go
func Serialize(inf *m.MemInfo) []byte { mu.Lock() defer mu.Unlock() // ensure the Builder is in a usable state. builder.Reset() structs.MemInfoStart(builder) structs.MemInfoAddTimestamp(builder, inf.Timestamp) structs.MemInfoAddTotalRAM(builder, inf.TotalRAM) structs.MemInfoAddFreeRAM(builder, inf.FreeRAM) str...
[ "func", "Serialize", "(", "inf", "*", "m", ".", "MemInfo", ")", "[", "]", "byte", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n", "// ensure the Builder is in a usable state.", "builder", ".", "Reset", "(", ")", "\...
// Serialize mem.MemInfo using Flatbuffers.
[ "Serialize", "mem", ".", "MemInfo", "using", "Flatbuffers", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/mem/flat/mem_unix.go#L47-L66
147,551
mohae/joefriday
sysinfo/mem/flat/mem_unix.go
Deserialize
func Deserialize(p []byte) *m.MemInfo { infoFlat := structs.GetRootAsMemInfo(p, 0) info := &m.MemInfo{} info.Timestamp = infoFlat.Timestamp() info.TotalRAM = infoFlat.TotalRAM() info.FreeRAM = infoFlat.FreeRAM() info.SharedRAM = infoFlat.SharedRAM() info.BufferRAM = infoFlat.BufferRAM() info.TotalSwap = infoFla...
go
func Deserialize(p []byte) *m.MemInfo { infoFlat := structs.GetRootAsMemInfo(p, 0) info := &m.MemInfo{} info.Timestamp = infoFlat.Timestamp() info.TotalRAM = infoFlat.TotalRAM() info.FreeRAM = infoFlat.FreeRAM() info.SharedRAM = infoFlat.SharedRAM() info.BufferRAM = infoFlat.BufferRAM() info.TotalSwap = infoFla...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "m", ".", "MemInfo", "{", "infoFlat", ":=", "structs", ".", "GetRootAsMemInfo", "(", "p", ",", "0", ")", "\n", "info", ":=", "&", "m", ".", "MemInfo", "{", "}", "\n", "info", ".", "Time...
// Deserialize takes some Flatbuffer serialized bytes and deserializes them as // mem.MemInfo.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserializes", "them", "as", "mem", ".", "MemInfo", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/mem/flat/mem_unix.go#L70-L81
147,552
mohae/joefriday
sysinfo/mem/flat/mem_unix.go
NewTicker
func NewTicker(d time.Duration) (joe.Tocker, error) { t := Ticker{Ticker: joe.NewTicker(d), Data: make(chan []byte)} go t.Run() return &t, nil }
go
func NewTicker(d time.Duration) (joe.Tocker, error) { t := Ticker{Ticker: joe.NewTicker(d), Data: make(chan []byte)} go t.Run() return &t, nil }
[ "func", "NewTicker", "(", "d", "time", ".", "Duration", ")", "(", "joe", ".", "Tocker", ",", "error", ")", "{", "t", ":=", "Ticker", "{", "Ticker", ":", "joe", ".", "NewTicker", "(", "d", ")", ",", "Data", ":", "make", "(", "chan", "[", "]", "b...
// NewTicker returns a new Ticker containing a Data channel that delivers the // data at intervals and an error channel that delivers any errors encountered. // Stop the ticker to signal the ticker to stop running. Stopping the ticker // does not close the Data channel; call Close to close both the ticker and the // da...
[ "NewTicker", "returns", "a", "new", "Ticker", "containing", "a", "Data", "channel", "that", "delivers", "the", "data", "at", "intervals", "and", "an", "error", "channel", "that", "delivers", "any", "errors", "encountered", ".", "Stop", "the", "ticker", "to", ...
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/mem/flat/mem_unix.go#L94-L98
147,553
mohae/joefriday
net/netdev/flat/netdev_unix.go
Deserialize
func Deserialize(p []byte) *structs.DevInfo { devInfo := flat.GetRootAsDevInfo(p, 0) // get the # of interfaces dLen := devInfo.DeviceLength() info := &structs.DevInfo{Timestamp: devInfo.Timestamp(), Device: make([]structs.Device, dLen)} fDev := &flat.Device{} sDev := structs.Device{} for i := 0; i < dLen; i++ {...
go
func Deserialize(p []byte) *structs.DevInfo { devInfo := flat.GetRootAsDevInfo(p, 0) // get the # of interfaces dLen := devInfo.DeviceLength() info := &structs.DevInfo{Timestamp: devInfo.Timestamp(), Device: make([]structs.Device, dLen)} fDev := &flat.Device{} sDev := structs.Device{} for i := 0; i < dLen; i++ {...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "structs", ".", "DevInfo", "{", "devInfo", ":=", "flat", ".", "GetRootAsDevInfo", "(", "p", ",", "0", ")", "\n", "// get the # of interfaces", "dLen", ":=", "devInfo", ".", "DeviceLength", "(", ...
// Deserialize takes some Flatbuffer serialized bytes and deserializes them as // structs.DevInfo.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserializes", "them", "as", "structs", ".", "DevInfo", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/net/netdev/flat/netdev_unix.go#L139-L169
147,554
mohae/joefriday
sysinfo/loadavg/loadavg_unix.go
Get
func (l *LoadAvg) Get() error { var sysinfo syscall.Sysinfo_t err := syscall.Sysinfo(&sysinfo) if err != nil { return err } l.Timestamp = time.Now().UTC().UnixNano() l.One = float64(sysinfo.Loads[0]) / LoadsScale l.Five = float64(sysinfo.Loads[1]) / LoadsScale l.Fifteen = float64(sysinfo.Loads[2]) / LoadsScal...
go
func (l *LoadAvg) Get() error { var sysinfo syscall.Sysinfo_t err := syscall.Sysinfo(&sysinfo) if err != nil { return err } l.Timestamp = time.Now().UTC().UnixNano() l.One = float64(sysinfo.Loads[0]) / LoadsScale l.Five = float64(sysinfo.Loads[1]) / LoadsScale l.Fifteen = float64(sysinfo.Loads[2]) / LoadsScal...
[ "func", "(", "l", "*", "LoadAvg", ")", "Get", "(", ")", "error", "{", "var", "sysinfo", "syscall", ".", "Sysinfo_t", "\n", "err", ":=", "syscall", ".", "Sysinfo", "(", "&", "sysinfo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n",...
// Get the load average for the last 1, 5, and 15 minutes.
[ "Get", "the", "load", "average", "for", "the", "last", "1", "5", "and", "15", "minutes", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/loadavg/loadavg_unix.go#L35-L46
147,555
mohae/joefriday
sysinfo/loadavg/loadavg_unix.go
Get
func Get() (LoadAvg, error) { var l LoadAvg err := l.Get() return l, err }
go
func Get() (LoadAvg, error) { var l LoadAvg err := l.Get() return l, err }
[ "func", "Get", "(", ")", "(", "LoadAvg", ",", "error", ")", "{", "var", "l", "LoadAvg", "\n", "err", ":=", "l", ".", "Get", "(", ")", "\n", "return", "l", ",", "err", "\n", "}" ]
// Get returns LoadAvg populated with the 1, 5, and 15 minute values.
[ "Get", "returns", "LoadAvg", "populated", "with", "the", "1", "5", "and", "15", "minute", "values", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/loadavg/loadavg_unix.go#L49-L53
147,556
mohae/joefriday
cpu/cpuinfo/cpuinfo_unix.go
Get
func Get() (inf *CPUInfo, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
go
func Get() (inf *CPUInfo, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
[ "func", "Get", "(", ")", "(", "inf", "*", "CPUInfo", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{", "std", ",", "err", "=", "NewProfiler", "("...
// Get returns the current cpuinfo using the package's global Profiler.
[ "Get", "returns", "the", "current", "cpuinfo", "using", "the", "package", "s", "global", "Profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpuinfo/cpuinfo_unix.go#L347-L357
147,557
mohae/joefriday
sysinfo/loadavg/json/loadavg_unix.go
Get
func Get() (p []byte, err error) { var l load.LoadAvg err = l.Get() if err != nil { return nil, err } return json.Marshal(&l) }
go
func Get() (p []byte, err error) { var l load.LoadAvg err = l.Get() if err != nil { return nil, err } return json.Marshal(&l) }
[ "func", "Get", "(", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "var", "l", "load", ".", "LoadAvg", "\n", "err", "=", "l", ".", "Get", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}"...
// Get returns the current LoadAvg as JSON serialized bytes.
[ "Get", "returns", "the", "current", "LoadAvg", "as", "JSON", "serialized", "bytes", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/loadavg/json/loadavg_unix.go#L32-L39
147,558
mohae/joefriday
sysinfo/loadavg/json/loadavg_unix.go
Deserialize
func Deserialize(p []byte) (*load.LoadAvg, error) { var l load.LoadAvg err := json.Unmarshal(p, &l) if err != nil { return nil, err } return &l, nil }
go
func Deserialize(p []byte) (*load.LoadAvg, error) { var l load.LoadAvg err := json.Unmarshal(p, &l) if err != nil { return nil, err } return &l, nil }
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "(", "*", "load", ".", "LoadAvg", ",", "error", ")", "{", "var", "l", "load", ".", "LoadAvg", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "p", ",", "&", "l", ")", "\n", "if", "err", ...
// Deserialize takes some JSON serialized bytes and unmarshals them as // loadavg.Loadavg.
[ "Deserialize", "takes", "some", "JSON", "serialized", "bytes", "and", "unmarshals", "them", "as", "loadavg", ".", "Loadavg", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/sysinfo/loadavg/json/loadavg_unix.go#L43-L50
147,559
mohae/joefriday
node/node_unix.go
NewProfiler
func NewProfiler() (prof *Profiler) { prof = &Profiler{} prof.SysFSSystemPath(joefriday.SysFSSystem) return prof }
go
func NewProfiler() (prof *Profiler) { prof = &Profiler{} prof.SysFSSystemPath(joefriday.SysFSSystem) return prof }
[ "func", "NewProfiler", "(", ")", "(", "prof", "*", "Profiler", ")", "{", "prof", "=", "&", "Profiler", "{", "}", "\n", "prof", ".", "SysFSSystemPath", "(", "joefriday", ".", "SysFSSystem", ")", "\n", "return", "prof", "\n", "}" ]
// Returns an initialized Profiler.
[ "Returns", "an", "initialized", "Profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/node/node_unix.go#L55-L59
147,560
mohae/joefriday
node/node_unix.go
Get
func (prof *Profiler) Get() (nodes *Nodes, err error) { nodes = &Nodes{} var x int32 // index of nodeX currently being processed. // First see if the node dir exists, return any error. _, err = os.Stat(prof.nodePath) if err != nil { return nil, err } // Loop and increment x after each dir read; stop when the ...
go
func (prof *Profiler) Get() (nodes *Nodes, err error) { nodes = &Nodes{} var x int32 // index of nodeX currently being processed. // First see if the node dir exists, return any error. _, err = os.Stat(prof.nodePath) if err != nil { return nil, err } // Loop and increment x after each dir read; stop when the ...
[ "func", "(", "prof", "*", "Profiler", ")", "Get", "(", ")", "(", "nodes", "*", "Nodes", ",", "err", "error", ")", "{", "nodes", "=", "&", "Nodes", "{", "}", "\n", "var", "x", "int32", "// index of nodeX currently being processed.", "\n\n", "// First see if...
// Get the node information. If the node tree doesn't exist an os.ErrNotExist // will be returned. During processing, any error will be returned along with a // nil for nodes.
[ "Get", "the", "node", "information", ".", "If", "the", "node", "tree", "doesn", "t", "exist", "an", "os", ".", "ErrNotExist", "will", "be", "returned", ".", "During", "processing", "any", "error", "will", "be", "returned", "along", "with", "a", "nil", "f...
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/node/node_unix.go#L69-L97
147,561
mohae/joefriday
node/node_unix.go
CPUList
func (prof *Profiler) CPUList(path string) (string, error) { p, err := ioutil.ReadFile(filepath.Join(path, CPUList)) if err != nil { return "", err } // the list is everything except for the trailing new line return string(p[:len(p)-1]), nil }
go
func (prof *Profiler) CPUList(path string) (string, error) { p, err := ioutil.ReadFile(filepath.Join(path, CPUList)) if err != nil { return "", err } // the list is everything except for the trailing new line return string(p[:len(p)-1]), nil }
[ "func", "(", "prof", "*", "Profiler", ")", "CPUList", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "p", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "path", ",", "CPUList", ")", ")", "\n", ...
// CPUList returns the string found in the CPUList file or any error that // occurs.
[ "CPUList", "returns", "the", "string", "found", "in", "the", "CPUList", "file", "or", "any", "error", "that", "occurs", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/node/node_unix.go#L105-L112
147,562
mohae/joefriday
system/uptime/json/uptime_unix.go
Serialize
func (prof *Profiler) Serialize(up u.Uptime) ([]byte, error) { return json.Marshal(up) }
go
func (prof *Profiler) Serialize(up u.Uptime) ([]byte, error) { return json.Marshal(up) }
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "up", "u", ".", "Uptime", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "up", ")", "\n", "}" ]
// Serialize uptime.Uptime as JSON.
[ "Serialize", "uptime", ".", "Uptime", "as", "JSON", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/uptime/json/uptime_unix.go#L73-L75
147,563
mohae/joefriday
system/uptime/json/uptime_unix.go
Unmarshal
func Unmarshal(p []byte) (up u.Uptime, err error) { return Deserialize(p) }
go
func Unmarshal(p []byte) (up u.Uptime, err error) { return Deserialize(p) }
[ "func", "Unmarshal", "(", "p", "[", "]", "byte", ")", "(", "up", "u", ".", "Uptime", ",", "err", "error", ")", "{", "return", "Deserialize", "(", "p", ")", "\n", "}" ]
// Unmarshal is an alias for Deserialize.
[ "Unmarshal", "is", "an", "alias", "for", "Deserialize", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/system/uptime/json/uptime_unix.go#L111-L113
147,564
mohae/joefriday
net/netdev/json/netdev_unix.go
Serialize
func (prof *Profiler) Serialize(inf *structs.DevInfo) ([]byte, error) { return json.Marshal(inf) }
go
func (prof *Profiler) Serialize(inf *structs.DevInfo) ([]byte, error) { return json.Marshal(inf) }
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "inf", "*", "structs", ".", "DevInfo", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "inf", ")", "\n", "}" ]
// Serialize network device information as JSON.
[ "Serialize", "network", "device", "information", "as", "JSON", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/net/netdev/json/netdev_unix.go#L75-L77
147,565
mohae/joefriday
net/netdev/json/netdev_unix.go
Deserialize
func Deserialize(p []byte) (*structs.DevInfo, error) { info := &structs.DevInfo{} err := json.Unmarshal(p, info) if err != nil { return nil, err } return info, nil }
go
func Deserialize(p []byte) (*structs.DevInfo, error) { info := &structs.DevInfo{} err := json.Unmarshal(p, info) if err != nil { return nil, err } return info, nil }
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "(", "*", "structs", ".", "DevInfo", ",", "error", ")", "{", "info", ":=", "&", "structs", ".", "DevInfo", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "p", ",", "info", ")", ...
// Deserialize takes some JSON serialized bytes and unmarshals them as // structs.DevInfo
[ "Deserialize", "takes", "some", "JSON", "serialized", "bytes", "and", "unmarshals", "them", "as", "structs", ".", "DevInfo" ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/net/netdev/json/netdev_unix.go#L105-L112
147,566
mohae/joefriday
mem/meminfo/flat/meminfo_unix.go
Deserialize
func Deserialize(p []byte) *mem.Info { infoFlat := structs.GetRootAsInfo(p, 0) info := &mem.Info{} info.Timestamp = infoFlat.Timestamp() info.Active = infoFlat.Active() info.ActiveAnon = infoFlat.ActiveAnon() info.ActiveFile = infoFlat.ActiveFile() info.AnonHugePages = infoFlat.AnonHugePages() info.AnonPages = ...
go
func Deserialize(p []byte) *mem.Info { infoFlat := structs.GetRootAsInfo(p, 0) info := &mem.Info{} info.Timestamp = infoFlat.Timestamp() info.Active = infoFlat.Active() info.ActiveAnon = infoFlat.ActiveAnon() info.ActiveFile = infoFlat.ActiveFile() info.AnonHugePages = infoFlat.AnonHugePages() info.AnonPages = ...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "mem", ".", "Info", "{", "infoFlat", ":=", "structs", ".", "GetRootAsInfo", "(", "p", ",", "0", ")", "\n", "info", ":=", "&", "mem", ".", "Info", "{", "}", "\n", "info", ".", "Timestamp...
// Deserialize takes some Flatbuffer serialized bytes and deserialize's them // as meminfo.Info.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserialize", "s", "them", "as", "meminfo", ".", "Info", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/mem/meminfo/flat/meminfo_unix.go#L150-L198
147,567
rsc/x86
x86asm/decode.go
instPrefix
func instPrefix(b byte, mode int) (Inst, error) { // When tracing it is useful to see what called instPrefix to report an error. if trace { _, file, line, _ := runtime.Caller(1) fmt.Printf("%s:%d\n", file, line) } p := Prefix(b) switch p { case PrefixDataSize: if mode == 16 { p = PrefixData32 } else { ...
go
func instPrefix(b byte, mode int) (Inst, error) { // When tracing it is useful to see what called instPrefix to report an error. if trace { _, file, line, _ := runtime.Caller(1) fmt.Printf("%s:%d\n", file, line) } p := Prefix(b) switch p { case PrefixDataSize: if mode == 16 { p = PrefixData32 } else { ...
[ "func", "instPrefix", "(", "b", "byte", ",", "mode", "int", ")", "(", "Inst", ",", "error", ")", "{", "// When tracing it is useful to see what called instPrefix to report an error.", "if", "trace", "{", "_", ",", "file", ",", "line", ",", "_", ":=", "runtime", ...
// instPrefix returns an Inst describing just one prefix byte. // It is only used if there is a prefix followed by an unintelligible // or invalid instruction byte sequence.
[ "instPrefix", "returns", "an", "Inst", "describing", "just", "one", "prefix", "byte", ".", "It", "is", "only", "used", "if", "there", "is", "a", "prefix", "followed", "by", "an", "unintelligible", "or", "invalid", "instruction", "byte", "sequence", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86asm/decode.go#L172-L197
147,568
rsc/x86
x86asm/decode.go
truncated
func truncated(src []byte, mode int) (Inst, error) { // return Inst{}, len(src), ErrTruncated return instPrefix(src[0], mode) // too long }
go
func truncated(src []byte, mode int) (Inst, error) { // return Inst{}, len(src), ErrTruncated return instPrefix(src[0], mode) // too long }
[ "func", "truncated", "(", "src", "[", "]", "byte", ",", "mode", "int", ")", "(", "Inst", ",", "error", ")", "{", "//\treturn Inst{}, len(src), ErrTruncated", "return", "instPrefix", "(", "src", "[", "0", "]", ",", "mode", ")", "// too long", "\n", "}" ]
// truncated reports a truncated instruction. // For now we use instPrefix but perhaps later we will return // a specific error here.
[ "truncated", "reports", "a", "truncated", "instruction", ".", "For", "now", "we", "use", "instPrefix", "but", "perhaps", "later", "we", "will", "return", "a", "specific", "error", "here", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86asm/decode.go#L202-L205
147,569
rsc/x86
x86asm/decode.go
prefixToSegment
func prefixToSegment(p Prefix) Reg { switch p &^ PrefixImplicit { case PrefixCS: return CS case PrefixDS: return DS case PrefixES: return ES case PrefixFS: return FS case PrefixGS: return GS case PrefixSS: return SS } return 0 }
go
func prefixToSegment(p Prefix) Reg { switch p &^ PrefixImplicit { case PrefixCS: return CS case PrefixDS: return DS case PrefixES: return ES case PrefixFS: return FS case PrefixGS: return GS case PrefixSS: return SS } return 0 }
[ "func", "prefixToSegment", "(", "p", "Prefix", ")", "Reg", "{", "switch", "p", "&^", "PrefixImplicit", "{", "case", "PrefixCS", ":", "return", "CS", "\n", "case", "PrefixDS", ":", "return", "DS", "\n", "case", "PrefixES", ":", "return", "ES", "\n", "case...
// prefixToSegment returns the segment register // corresponding to a particular segment prefix.
[ "prefixToSegment", "returns", "the", "segment", "register", "corresponding", "to", "a", "particular", "segment", "prefix", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86asm/decode.go#L1538-L1554
147,570
mohae/joefriday
cpu/cpuutil/cpuutil_unix.go
Get
func Get() (*CPUUtil, error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { var err error std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
go
func Get() (*CPUUtil, error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { var err error std, err = NewProfiler() if err != nil { return nil, err } } return std.Get() }
[ "func", "Get", "(", ")", "(", "*", "CPUUtil", ",", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{", "var", "err", "error", "\n", "std", ",", "err", "=", "...
// Get returns the current cpu utilization using the package's global Profiler. // The Profiler is instantiated lazily. If the profiler doesn't already exist, // the first usage information will not be useful due to minimal time elapsing // between the initial and second snapshots used for usage calculations; the // re...
[ "Get", "returns", "the", "current", "cpu", "utilization", "using", "the", "package", "s", "global", "Profiler", ".", "The", "Profiler", "is", "instantiated", "lazily", ".", "If", "the", "profiler", "doesn", "t", "already", "exist", "the", "first", "usage", "...
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpuutil/cpuutil_unix.go#L105-L116
147,571
mohae/joefriday
cpu/cpux/cpux_unix.go
Get
func (prof *Profiler) Get() (*CPUs, error) { cpus := &CPUs{CPU: make([]CPU, prof.NumCPU)} var err error var pids []int32 // the physical ids encountered hasFreq := prof.hasCPUFreq() for x := 0; x < prof.NumCPU; x++ { var cpu CPU var found bool cpu.PhysicalPackageID, err = prof.physicalPackageID(x) if err...
go
func (prof *Profiler) Get() (*CPUs, error) { cpus := &CPUs{CPU: make([]CPU, prof.NumCPU)} var err error var pids []int32 // the physical ids encountered hasFreq := prof.hasCPUFreq() for x := 0; x < prof.NumCPU; x++ { var cpu CPU var found bool cpu.PhysicalPackageID, err = prof.physicalPackageID(x) if err...
[ "func", "(", "prof", "*", "Profiler", ")", "Get", "(", ")", "(", "*", "CPUs", ",", "error", ")", "{", "cpus", ":=", "&", "CPUs", "{", "CPU", ":", "make", "(", "[", "]", "CPU", ",", "prof", ".", "NumCPU", ")", "}", "\n", "var", "err", "error",...
// Get the cpuX info for each cpu. Currently only min and max frequency are // implemented.
[ "Get", "the", "cpuX", "info", "for", "each", "cpu", ".", "Currently", "only", "min", "and", "max", "frequency", "are", "implemented", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpux/cpux_unix.go#L104-L170
147,572
mohae/joefriday
cpu/cpux/cpux_unix.go
cpuXPath
func (prof *Profiler) cpuXPath(x int) string { return filepath.Join(prof.cpuPath, fmt.Sprintf("cpu%d", x)) }
go
func (prof *Profiler) cpuXPath(x int) string { return filepath.Join(prof.cpuPath, fmt.Sprintf("cpu%d", x)) }
[ "func", "(", "prof", "*", "Profiler", ")", "cpuXPath", "(", "x", "int", ")", "string", "{", "return", "filepath", ".", "Join", "(", "prof", ".", "cpuPath", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "x", ")", ")", "\n", "}" ]
// cpuXPath returns the system's cpuX path for a given cpu number.
[ "cpuXPath", "returns", "the", "system", "s", "cpuX", "path", "for", "a", "given", "cpu", "number", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpux/cpux_unix.go#L173-L175
147,573
mohae/joefriday
cpu/cpux/cpux_unix.go
coreIDPath
func (prof *Profiler) coreIDPath(x int) string { return fmt.Sprintf("%s/topology/core_id", prof.cpuXPath(x)) }
go
func (prof *Profiler) coreIDPath(x int) string { return fmt.Sprintf("%s/topology/core_id", prof.cpuXPath(x)) }
[ "func", "(", "prof", "*", "Profiler", ")", "coreIDPath", "(", "x", "int", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prof", ".", "cpuXPath", "(", "x", ")", ")", "\n", "}" ]
// coreIDPath returns the path of the core_id file for the given cpuX.
[ "coreIDPath", "returns", "the", "path", "of", "the", "core_id", "file", "for", "the", "given", "cpuX", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpux/cpux_unix.go#L178-L180
147,574
mohae/joefriday
cpu/cpux/cpux_unix.go
coreID
func (prof *Profiler) coreID(x int) (int32, error) { v, err := ioutil.ReadFile(prof.coreIDPath(x)) if err != nil { return 0, err } id, err := strconv.Atoi(string(v[:len(v)-1])) if err != nil { return 0, fmt.Errorf("cpu%d core_id: conversion error: %s", x, err) } return int32(id), nil }
go
func (prof *Profiler) coreID(x int) (int32, error) { v, err := ioutil.ReadFile(prof.coreIDPath(x)) if err != nil { return 0, err } id, err := strconv.Atoi(string(v[:len(v)-1])) if err != nil { return 0, fmt.Errorf("cpu%d core_id: conversion error: %s", x, err) } return int32(id), nil }
[ "func", "(", "prof", "*", "Profiler", ")", "coreID", "(", "x", "int", ")", "(", "int32", ",", "error", ")", "{", "v", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "prof", ".", "coreIDPath", "(", "x", ")", ")", "\n", "if", "err", "!=", "nil...
// gets the core_id of cpuX
[ "gets", "the", "core_id", "of", "cpuX" ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpux/cpux_unix.go#L215-L225
147,575
mohae/joefriday
cpu/cpux/cpux_unix.go
cpuMHzMin
func (prof *Profiler) cpuMHzMin(x int) (float32, error) { v, err := ioutil.ReadFile(prof.cpuInfoFreqMinPath(x)) if err != nil { return 0, err } // insert the . in the appropriate spot v = append(v[:len(v)-4], append([]byte{'.'}, v[len(v)-4:len(v)-1]...)...) m, err := strconv.ParseFloat(string(v[:len(v)-1]), 32)...
go
func (prof *Profiler) cpuMHzMin(x int) (float32, error) { v, err := ioutil.ReadFile(prof.cpuInfoFreqMinPath(x)) if err != nil { return 0, err } // insert the . in the appropriate spot v = append(v[:len(v)-4], append([]byte{'.'}, v[len(v)-4:len(v)-1]...)...) m, err := strconv.ParseFloat(string(v[:len(v)-1]), 32)...
[ "func", "(", "prof", "*", "Profiler", ")", "cpuMHzMin", "(", "x", "int", ")", "(", "float32", ",", "error", ")", "{", "v", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "prof", ".", "cpuInfoFreqMinPath", "(", "x", ")", ")", "\n", "if", "err", ...
// gets the cpu_mhz_min information
[ "gets", "the", "cpu_mhz_min", "information" ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpux/cpux_unix.go#L241-L253
147,576
mohae/joefriday
cpu/cpux/cpux_unix.go
cache
func (prof *Profiler) cache(x int, cpu *CPU) error { cpu.Cache = map[string]string{} //go through all the entries in cpuX/cache p := prof.cachePath(x) dirs, err := ioutil.ReadDir(p) if err != nil { return err } var cacheID string // all the entries should be dirs with their contents holding the cache info fo...
go
func (prof *Profiler) cache(x int, cpu *CPU) error { cpu.Cache = map[string]string{} //go through all the entries in cpuX/cache p := prof.cachePath(x) dirs, err := ioutil.ReadDir(p) if err != nil { return err } var cacheID string // all the entries should be dirs with their contents holding the cache info fo...
[ "func", "(", "prof", "*", "Profiler", ")", "cache", "(", "x", "int", ",", "cpu", "*", "CPU", ")", "error", "{", "cpu", ".", "Cache", "=", "map", "[", "string", "]", "string", "{", "}", "\n", "//go through all the entries in cpuX/cache", "p", ":=", "pro...
// Get the cache info for the given cpuX entry
[ "Get", "the", "cache", "info", "for", "the", "given", "cpuX", "entry" ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpux/cpux_unix.go#L271-L318
147,577
rsc/x86
x86map/map.go
readCSV
func readCSV(file string) (*Prog, error) { // Read input. // Skip leading blank and # comment lines. f, err := os.Open(file) if err != nil { return nil, err } b := bufio.NewReader(f) for { c, err := b.ReadByte() if err != nil { break } if c == '\n' { continue } if c == '#' { b.ReadBytes('\...
go
func readCSV(file string) (*Prog, error) { // Read input. // Skip leading blank and # comment lines. f, err := os.Open(file) if err != nil { return nil, err } b := bufio.NewReader(f) for { c, err := b.ReadByte() if err != nil { break } if c == '\n' { continue } if c == '#' { b.ReadBytes('\...
[ "func", "readCSV", "(", "file", "string", ")", "(", "*", "Prog", ",", "error", ")", "{", "// Read input.", "// Skip leading blank and # comment lines.", "f", ",", "err", ":=", "os", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// readCSV reads the CSV file and returns the corresponding Prog. // It may print details about problems to standard error using the log package.
[ "readCSV", "reads", "the", "CSV", "file", "and", "returns", "the", "corresponding", "Prog", ".", "It", "may", "print", "details", "about", "problems", "to", "standard", "error", "using", "the", "log", "package", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L76-L118
147,578
rsc/x86
x86map/map.go
keys
func (p *Prog) keys() []string { var keys []string for key := range p.Child { keys = append(keys, key) } sort.Strings(keys) return keys }
go
func (p *Prog) keys() []string { var keys []string for key := range p.Child { keys = append(keys, key) } sort.Strings(keys) return keys }
[ "func", "(", "p", "*", "Prog", ")", "keys", "(", ")", "[", "]", "string", "{", "var", "keys", "[", "]", "string", "\n", "for", "key", ":=", "range", "p", ".", "Child", "{", "keys", "=", "append", "(", "keys", ",", "key", ")", "\n", "}", "\n",...
// keys returns the child keys in sorted order.
[ "keys", "returns", "the", "child", "keys", "in", "sorted", "order", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L136-L143
147,579
rsc/x86
x86map/map.go
findChildLeaf
func (p *Prog) findChildLeaf() string { for { if len(p.Child) == 0 { return p.Path } p = p.Child[p.keys()[0]] } }
go
func (p *Prog) findChildLeaf() string { for { if len(p.Child) == 0 { return p.Path } p = p.Child[p.keys()[0]] } }
[ "func", "(", "p", "*", "Prog", ")", "findChildLeaf", "(", ")", "string", "{", "for", "{", "if", "len", "(", "p", ".", "Child", ")", "==", "0", "{", "return", "p", ".", "Path", "\n", "}", "\n", "p", "=", "p", ".", "Child", "[", "p", ".", "ke...
// findChildLeaf finds a leaf node in the subtree rooted at p // and returns that node's full path. The path is useful in error // messages as an example of where a particular subtree is headed.
[ "findChildLeaf", "finds", "a", "leaf", "node", "in", "the", "subtree", "rooted", "at", "p", "and", "returns", "that", "node", "s", "full", "path", ".", "The", "path", "is", "useful", "in", "error", "messages", "as", "an", "example", "of", "where", "a", ...
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L148-L155
147,580
rsc/x86
x86map/map.go
check
func check(p *Prog) { if p.Child["any"] != nil && len(p.Child) > 1 { for _, key := range p.keys() { if key != "any" { mergeCopy(p.Child[key], p.Child["any"]) } } if allKeys[p.Action] == nil { log.Printf("%s: unknown key space for %s=any", p.Path, p.Action) } for _, key := range allKeys[p.Action]...
go
func check(p *Prog) { if p.Child["any"] != nil && len(p.Child) > 1 { for _, key := range p.keys() { if key != "any" { mergeCopy(p.Child[key], p.Child["any"]) } } if allKeys[p.Action] == nil { log.Printf("%s: unknown key space for %s=any", p.Path, p.Action) } for _, key := range allKeys[p.Action]...
[ "func", "check", "(", "p", "*", "Prog", ")", "{", "if", "p", ".", "Child", "[", "\"", "\"", "]", "!=", "nil", "&&", "len", "(", "p", ".", "Child", ")", ">", "1", "{", "for", "_", ",", "key", ":=", "range", "p", ".", "keys", "(", ")", "{",...
// check checks that the program tree is well-formed. // It also merges "any" keys into specific decoding keys in order to // create an invariant that a particular check node either has a // single "any" child - making it a no-op - or has no "any" children. // See the discussion of "any" in the comment for add above.
[ "check", "checks", "that", "the", "program", "tree", "is", "well", "-", "formed", ".", "It", "also", "merges", "any", "keys", "into", "specific", "decoding", "keys", "in", "order", "to", "create", "an", "invariant", "that", "a", "particular", "check", "nod...
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L417-L445
147,581
rsc/x86
x86map/map.go
mergeCopy
func mergeCopy(dst, src *Prog) { //log.Printf("merge %s|%s and %s|%s\n", dst.Path, dst.Action, src.Path, src.Action) if dst.Action != src.Action { log.Printf("cannot merge %s|%s and %s|%s", dst.Path, dst.Action, src.Path, src.Action) return } for _, key := range src.keys() { if dst.Child[key] == nil { // ...
go
func mergeCopy(dst, src *Prog) { //log.Printf("merge %s|%s and %s|%s\n", dst.Path, dst.Action, src.Path, src.Action) if dst.Action != src.Action { log.Printf("cannot merge %s|%s and %s|%s", dst.Path, dst.Action, src.Path, src.Action) return } for _, key := range src.keys() { if dst.Child[key] == nil { // ...
[ "func", "mergeCopy", "(", "dst", ",", "src", "*", "Prog", ")", "{", "//log.Printf(\"merge %s|%s and %s|%s\\n\", dst.Path, dst.Action, src.Path, src.Action)", "if", "dst", ".", "Action", "!=", "src", ".", "Action", "{", "log", ".", "Printf", "(", "\"", "\"", ",", ...
// mergeCopy merges a copy of the tree rooted at src into dst. // It is only used once no more paths will be added to the tree, // so it is safe to introduce cross-links that make the program // a dag rather than a tree.
[ "mergeCopy", "merges", "a", "copy", "of", "the", "tree", "rooted", "at", "src", "into", "dst", ".", "It", "is", "only", "used", "once", "no", "more", "paths", "will", "be", "added", "to", "the", "tree", "so", "it", "is", "safe", "to", "introduce", "c...
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L451-L467
147,582
rsc/x86
x86map/map.go
set
func set(all string) map[string]bool { m := map[string]bool{} for _, f := range strings.Fields(all) { m[f] = true } return m }
go
func set(all string) map[string]bool { m := map[string]bool{} for _, f := range strings.Fields(all) { m[f] = true } return m }
[ "func", "set", "(", "all", "string", ")", "map", "[", "string", "]", "bool", "{", "m", ":=", "map", "[", "string", "]", "bool", "{", "}", "\n", "for", "_", ",", "f", ":=", "range", "strings", ".", "Fields", "(", "all", ")", "{", "m", "[", "f"...
// set returns a map mapping each of the words in all to true.
[ "set", "returns", "a", "map", "mapping", "each", "of", "the", "words", "in", "all", "to", "true", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L470-L476
147,583
rsc/x86
x86map/map.go
isHex
func isHex(s string) bool { if i := strings.Index(s, "+"); i >= 0 { s = s[:i] } if len(s) != 2 { return false } for i := 0; i < len(s); i++ { c := s[i] if '0' <= c && c <= '9' || 'A' <= c && c <= 'F' { continue } return false } return true }
go
func isHex(s string) bool { if i := strings.Index(s, "+"); i >= 0 { s = s[:i] } if len(s) != 2 { return false } for i := 0; i < len(s); i++ { c := s[i] if '0' <= c && c <= '9' || 'A' <= c && c <= 'F' { continue } return false } return true }
[ "func", "isHex", "(", "s", "string", ")", "bool", "{", "if", "i", ":=", "strings", ".", "Index", "(", "s", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "s", "=", "s", "[", ":", "i", "]", "\n", "}", "\n", "if", "len", "(", "s", ")", "...
// isHex reports whether the argument is a two digit hex number // possibly followed by a +foo suffix.
[ "isHex", "reports", "whether", "the", "argument", "is", "a", "two", "digit", "hex", "number", "possibly", "followed", "by", "a", "+", "foo", "suffix", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L511-L526
147,584
rsc/x86
x86map/map.go
printDecoder
func printDecoder(p *Prog) { opMap := map[string]bool{ "PAUSE": true, } printDecoderPass(p, 1, false, opMap) fmt.Printf("// DO NOT EDIT\n") fmt.Printf("// generated by: x86map -fmt=decoder %s\n", inputFile) fmt.Printf("\n") fmt.Printf("package x86asm\n\n") fmt.Printf("var decoder = [...]uint16{\n\tuint16(xFai...
go
func printDecoder(p *Prog) { opMap := map[string]bool{ "PAUSE": true, } printDecoderPass(p, 1, false, opMap) fmt.Printf("// DO NOT EDIT\n") fmt.Printf("// generated by: x86map -fmt=decoder %s\n", inputFile) fmt.Printf("\n") fmt.Printf("package x86asm\n\n") fmt.Printf("var decoder = [...]uint16{\n\tuint16(xFai...
[ "func", "printDecoder", "(", "p", "*", "Prog", ")", "{", "opMap", ":=", "map", "[", "string", "]", "bool", "{", "\"", "\"", ":", "true", ",", "}", "\n", "printDecoderPass", "(", "p", ",", "1", ",", "false", ",", "opMap", ")", "\n", "fmt", ".", ...
// printDecoder prints a Go array containing the decoder program. // It runs in two passes, both of which traverse and could generate // the entire program. The first pass records the PC for each Prog node, // and the second pass emits the actual program, using the PCs as jump // targets in the places where the program...
[ "printDecoder", "prints", "a", "Go", "array", "containing", "the", "decoder", "program", ".", "It", "runs", "in", "two", "passes", "both", "of", "which", "traverse", "and", "could", "generate", "the", "entire", "program", ".", "The", "first", "pass", "record...
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L624-L658
147,585
rsc/x86
x86map/map.go
printScanner
func printScanner(p *Prog) { walkScanTree(p, -1) var out []uint16 out = append(out, 0) emitScanFunc(p, &out) fmt.Printf("var scanProg = []uint16{\n") fmt.Printf("\t/*0*/ 0, // dead\n") for i := 1; i < len(out); i++ { fmt.Printf("\t/*%d*/ ", i) switch out[i] { default: log.Fatalf("malformed program %#x",...
go
func printScanner(p *Prog) { walkScanTree(p, -1) var out []uint16 out = append(out, 0) emitScanFunc(p, &out) fmt.Printf("var scanProg = []uint16{\n") fmt.Printf("\t/*0*/ 0, // dead\n") for i := 1; i < len(out); i++ { fmt.Printf("\t/*%d*/ ", i) switch out[i] { default: log.Fatalf("malformed program %#x",...
[ "func", "printScanner", "(", "p", "*", "Prog", ")", "{", "walkScanTree", "(", "p", ",", "-", "1", ")", "\n", "var", "out", "[", "]", "uint16", "\n", "out", "=", "append", "(", "out", ",", "0", ")", "\n", "emitScanFunc", "(", "p", ",", "&", "out...
// printScanner prints the decoding table for a scanner. // The scanner can identify instruction boundaries but does not do // full decoding. It is meant to be lighter weight than the x86asm // decoder tables.
[ "printScanner", "prints", "the", "decoding", "table", "for", "a", "scanner", ".", "The", "scanner", "can", "identify", "instruction", "boundaries", "but", "does", "not", "do", "full", "decoding", ".", "It", "is", "meant", "to", "be", "lighter", "weight", "th...
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L664-L756
147,586
rsc/x86
x86map/map.go
printDecoderPass
func printDecoderPass(p *Prog, pc int, printing bool, ops map[string]bool) int { // Record PC on first pass. if p.PC == 0 { p.PC = pc } // If PC doesn't match, we've already printed this code // because it was reached some other way. Jump to that copy. if p.PC != pc { if printing { fmt.Printf("/*%d*/\tuin...
go
func printDecoderPass(p *Prog, pc int, printing bool, ops map[string]bool) int { // Record PC on first pass. if p.PC == 0 { p.PC = pc } // If PC doesn't match, we've already printed this code // because it was reached some other way. Jump to that copy. if p.PC != pc { if printing { fmt.Printf("/*%d*/\tuin...
[ "func", "printDecoderPass", "(", "p", "*", "Prog", ",", "pc", "int", ",", "printing", "bool", ",", "ops", "map", "[", "string", "]", "bool", ")", "int", "{", "// Record PC on first pass.", "if", "p", ".", "PC", "==", "0", "{", "p", ".", "PC", "=", ...
// printDecoderPass prints the decoding table program for p, // assuming that we are emitting code at the given program counter. // It returns the new current program counter, that is, the program // counter after the printed instructions. // If printing==false, printDecoderPass does not print the actual // code words ...
[ "printDecoderPass", "prints", "the", "decoding", "table", "program", "for", "p", "assuming", "that", "we", "are", "emitting", "code", "at", "the", "given", "program", "counter", ".", "It", "returns", "the", "new", "current", "program", "counter", "that", "is",...
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L1086-L1304
147,587
rsc/x86
x86map/map.go
childPC
func (p *Prog) childPC(key string) int { q := p.Child[key] if q == nil { return 0 } return q.PC }
go
func (p *Prog) childPC(key string) int { q := p.Child[key] if q == nil { return 0 } return q.PC }
[ "func", "(", "p", "*", "Prog", ")", "childPC", "(", "key", "string", ")", "int", "{", "q", ":=", "p", ".", "Child", "[", "key", "]", "\n", "if", "q", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "q", ".", "PC", "\n", "}" ]
// childPC returns the PC for the given child key. // If the key is not present, it returns PC 0, // which is known to be an xFail instruction.
[ "childPC", "returns", "the", "PC", "for", "the", "given", "child", "key", ".", "If", "the", "key", "is", "not", "present", "it", "returns", "PC", "0", "which", "is", "known", "to", "be", "an", "xFail", "instruction", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L1309-L1315
147,588
rsc/x86
x86map/map.go
isLetterDigit
func isLetterDigit(c byte) bool { return 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' }
go
func isLetterDigit(c byte) bool { return 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' }
[ "func", "isLetterDigit", "(", "c", "byte", ")", "bool", "{", "return", "'a'", "<=", "c", "&&", "c", "<=", "'z'", "||", "'A'", "<=", "c", "&&", "c", "<=", "'Z'", "||", "'0'", "<=", "c", "&&", "c", "<=", "'9'", "\n", "}" ]
// isLetterDigit reports whether c is an ASCII letter or digit.
[ "isLetterDigit", "reports", "whether", "c", "is", "an", "ASCII", "letter", "or", "digit", "." ]
01d8f0379593fd888e08a4c4057d69f5765ab2e4
https://github.com/rsc/x86/blob/01d8f0379593fd888e08a4c4057d69f5765ab2e4/x86map/map.go#L1323-L1325
147,589
mohae/joefriday
disk/diskstats/flat/diskstats_unix.go
Deserialize
func Deserialize(p []byte) *structs.DiskStats { stts := &structs.DiskStats{} devF := &flat.Device{} statsFlat := flat.GetRootAsDiskStats(p, 0) stts.Timestamp = statsFlat.Timestamp() len := statsFlat.DeviceLength() stts.Device = make([]structs.Device, len) for i := 0; i < len; i++ { var dev structs.Device if ...
go
func Deserialize(p []byte) *structs.DiskStats { stts := &structs.DiskStats{} devF := &flat.Device{} statsFlat := flat.GetRootAsDiskStats(p, 0) stts.Timestamp = statsFlat.Timestamp() len := statsFlat.DeviceLength() stts.Device = make([]structs.Device, len) for i := 0; i < len; i++ { var dev structs.Device if ...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "structs", ".", "DiskStats", "{", "stts", ":=", "&", "structs", ".", "DiskStats", "{", "}", "\n", "devF", ":=", "&", "flat", ".", "Device", "{", "}", "\n", "statsFlat", ":=", "flat", ".",...
// Deserialize takes some Flatbuffer serialized bytes and deserialize's them // as a structs.DiskStats.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserialize", "s", "them", "as", "a", "structs", ".", "DiskStats", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/disk/diskstats/flat/diskstats_unix.go#L138-L166
147,590
mohae/joefriday
cpu/cpustats/json/cpustats_unix.go
Serialize
func (prof *Profiler) Serialize(st *stats.CPUStats) ([]byte, error) { return json.Marshal(st) }
go
func (prof *Profiler) Serialize(st *stats.CPUStats) ([]byte, error) { return json.Marshal(st) }
[ "func", "(", "prof", "*", "Profiler", ")", "Serialize", "(", "st", "*", "stats", ".", "CPUStats", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "st", ")", "\n", "}" ]
// Serialize cpustats.CPUStats as JSON.
[ "Serialize", "cpustats", ".", "CPUStats", "as", "JSON", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpustats/json/cpustats_unix.go#L76-L78
147,591
mohae/joefriday
cpu/cpustats/json/cpustats_unix.go
Serialize
func Serialize(st *stats.CPUStats) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(st) }
go
func Serialize(st *stats.CPUStats) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(st) }
[ "func", "Serialize", "(", "st", "*", "stats", ".", "CPUStats", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{",...
// Serialize cpustats.CPUStats as JSON using package globals.
[ "Serialize", "cpustats", ".", "CPUStats", "as", "JSON", "using", "package", "globals", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpustats/json/cpustats_unix.go#L81-L91
147,592
mohae/joefriday
cpu/cpustats/json/cpustats_unix.go
Deserialize
func Deserialize(p []byte) (*stats.CPUStats, error) { st := &stats.CPUStats{} err := json.Unmarshal(p, st) if err != nil { return nil, err } return st, nil }
go
func Deserialize(p []byte) (*stats.CPUStats, error) { st := &stats.CPUStats{} err := json.Unmarshal(p, st) if err != nil { return nil, err } return st, nil }
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "(", "*", "stats", ".", "CPUStats", ",", "error", ")", "{", "st", ":=", "&", "stats", ".", "CPUStats", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "p", ",", "st", ")", "\n"...
// Deserialize takes some JSON serialized bytes and unmarshals them as // cpustats.Stats
[ "Deserialize", "takes", "some", "JSON", "serialized", "bytes", "and", "unmarshals", "them", "as", "cpustats", ".", "Stats" ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/cpu/cpustats/json/cpustats_unix.go#L105-L112
147,593
logicmonitor/k8s-collectorset-controller
pkg/config/config.go
New
func New() (*Config, error) { c := &Config{} err := envconfig.Process("collectorset-controller", c) if err != nil { return nil, err } return c, nil }
go
func New() (*Config, error) { c := &Config{} err := envconfig.Process("collectorset-controller", c) if err != nil { return nil, err } return c, nil }
[ "func", "New", "(", ")", "(", "*", "Config", ",", "error", ")", "{", "c", ":=", "&", "Config", "{", "}", "\n", "err", ":=", "envconfig", ".", "Process", "(", "\"", "\"", ",", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ","...
// New returns the application configuration specified by the config file.
[ "New", "returns", "the", "application", "configuration", "specified", "by", "the", "config", "file", "." ]
efaec105bacc60399c4e0d332b1adc93f1282262
https://github.com/logicmonitor/k8s-collectorset-controller/blob/efaec105bacc60399c4e0d332b1adc93f1282262/pkg/config/config.go#L20-L28
147,594
mohae/joefriday
disk/diskusage/flat/diskusage_unix.go
Serialize
func Serialize(u *structs.DiskUsage) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(u), nil }
go
func Serialize(u *structs.DiskUsage) (p []byte, err error) { stdMu.Lock() defer stdMu.Unlock() if std == nil { std, err = NewProfiler() if err != nil { return nil, err } } return std.Serialize(u), nil }
[ "func", "Serialize", "(", "u", "*", "structs", ".", "DiskUsage", ")", "(", "p", "[", "]", "byte", ",", "err", "error", ")", "{", "stdMu", ".", "Lock", "(", ")", "\n", "defer", "stdMu", ".", "Unlock", "(", ")", "\n", "if", "std", "==", "nil", "{...
// Serialize IO usage of the block devices as Flatbuffer serialized bytes using // the package's global Profiler.
[ "Serialize", "IO", "usage", "of", "the", "block", "devices", "as", "Flatbuffer", "serialized", "bytes", "using", "the", "package", "s", "global", "Profiler", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/disk/diskusage/flat/diskusage_unix.go#L138-L148
147,595
mohae/joefriday
disk/diskusage/flat/diskusage_unix.go
Deserialize
func Deserialize(p []byte) *structs.DiskUsage { u := &structs.DiskUsage{} devF := &flat.Device{} uF := flat.GetRootAsDiskUsage(p, 0) u.Timestamp = uF.Timestamp() u.TimeDelta = uF.TimeDelta() len := uF.DeviceLength() u.Device = make([]structs.Device, len) for i := 0; i < len; i++ { var dev structs.Device if ...
go
func Deserialize(p []byte) *structs.DiskUsage { u := &structs.DiskUsage{} devF := &flat.Device{} uF := flat.GetRootAsDiskUsage(p, 0) u.Timestamp = uF.Timestamp() u.TimeDelta = uF.TimeDelta() len := uF.DeviceLength() u.Device = make([]structs.Device, len) for i := 0; i < len; i++ { var dev structs.Device if ...
[ "func", "Deserialize", "(", "p", "[", "]", "byte", ")", "*", "structs", ".", "DiskUsage", "{", "u", ":=", "&", "structs", ".", "DiskUsage", "{", "}", "\n", "devF", ":=", "&", "flat", ".", "Device", "{", "}", "\n", "uF", ":=", "flat", ".", "GetRoo...
// Deserialize takes some Flatbuffer serialized bytes and deserializes them // as a structs.DiskUsage.
[ "Deserialize", "takes", "some", "Flatbuffer", "serialized", "bytes", "and", "deserializes", "them", "as", "a", "structs", ".", "DiskUsage", "." ]
2d83fc975dd8b328ca863387d13963f8fd12f260
https://github.com/mohae/joefriday/blob/2d83fc975dd8b328ca863387d13963f8fd12f260/disk/diskusage/flat/diskusage_unix.go#L152-L181
147,596
logicmonitor/k8s-collectorset-controller
pkg/apis/v1alpha1/zz_generated.deepcopy.go
DeepCopy
func (in *CollectorSet) DeepCopy() *CollectorSet { if in == nil { return nil } out := new(CollectorSet) in.DeepCopyInto(out) return out }
go
func (in *CollectorSet) DeepCopy() *CollectorSet { if in == nil { return nil } out := new(CollectorSet) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "CollectorSet", ")", "DeepCopy", "(", ")", "*", "CollectorSet", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "CollectorSet", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorSet.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "CollectorSet", "." ]
efaec105bacc60399c4e0d332b1adc93f1282262
https://github.com/logicmonitor/k8s-collectorset-controller/blob/efaec105bacc60399c4e0d332b1adc93f1282262/pkg/apis/v1alpha1/zz_generated.deepcopy.go#L53-L60
147,597
logicmonitor/k8s-collectorset-controller
pkg/apis/v1alpha1/zz_generated.deepcopy.go
DeepCopy
func (in *CollectorSetList) DeepCopy() *CollectorSetList { if in == nil { return nil } out := new(CollectorSetList) in.DeepCopyInto(out) return out }
go
func (in *CollectorSetList) DeepCopy() *CollectorSetList { if in == nil { return nil } out := new(CollectorSetList) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "CollectorSetList", ")", "DeepCopy", "(", ")", "*", "CollectorSetList", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "CollectorSetList", ")", "\n", "in", ".", "DeepCopyInto", "(",...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorSetList.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "CollectorSetList", "." ]
efaec105bacc60399c4e0d332b1adc93f1282262
https://github.com/logicmonitor/k8s-collectorset-controller/blob/efaec105bacc60399c4e0d332b1adc93f1282262/pkg/apis/v1alpha1/zz_generated.deepcopy.go#L87-L94
147,598
logicmonitor/k8s-collectorset-controller
pkg/apis/v1alpha1/zz_generated.deepcopy.go
DeepCopy
func (in *CollectorSetPolicy) DeepCopy() *CollectorSetPolicy { if in == nil { return nil } out := new(CollectorSetPolicy) in.DeepCopyInto(out) return out }
go
func (in *CollectorSetPolicy) DeepCopy() *CollectorSetPolicy { if in == nil { return nil } out := new(CollectorSetPolicy) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "CollectorSetPolicy", ")", "DeepCopy", "(", ")", "*", "CollectorSetPolicy", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "CollectorSetPolicy", ")", "\n", "in", ".", "DeepCopyInto", ...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorSetPolicy.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "CollectorSetPolicy", "." ]
efaec105bacc60399c4e0d332b1adc93f1282262
https://github.com/logicmonitor/k8s-collectorset-controller/blob/efaec105bacc60399c4e0d332b1adc93f1282262/pkg/apis/v1alpha1/zz_generated.deepcopy.go#L121-L128
147,599
logicmonitor/k8s-collectorset-controller
pkg/apis/v1alpha1/zz_generated.deepcopy.go
DeepCopy
func (in *CollectorSetSpec) DeepCopy() *CollectorSetSpec { if in == nil { return nil } out := new(CollectorSetSpec) in.DeepCopyInto(out) return out }
go
func (in *CollectorSetSpec) DeepCopy() *CollectorSetSpec { if in == nil { return nil } out := new(CollectorSetSpec) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "CollectorSetSpec", ")", "DeepCopy", "(", ")", "*", "CollectorSetSpec", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "CollectorSetSpec", ")", "\n", "in", ".", "DeepCopyInto", "(",...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorSetSpec.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "CollectorSetSpec", "." ]
efaec105bacc60399c4e0d332b1adc93f1282262
https://github.com/logicmonitor/k8s-collectorset-controller/blob/efaec105bacc60399c4e0d332b1adc93f1282262/pkg/apis/v1alpha1/zz_generated.deepcopy.go#L155-L162