Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Minor fixes #1

Merged
merged 2 commits into from
Mar 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions btrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"time"

"traceout/ftrace"
"github.com/google/traceout/ftrace"
)

import _ "net/http/pprof"
Expand Down Expand Up @@ -93,7 +93,7 @@ func do_main() error {
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, os.Interrupt)

f, err := ftrace.Ftrace(fp)
f, err := ftrace.New(fp)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion ftrace/cprintf/cprintf.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"fmt"
"strings"

"traceout/ftrace/cparse"
"github.com/google/traceout/ftrace/cparse"
)

type printfFunction struct {
Expand Down
6 changes: 3 additions & 3 deletions ftrace/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var order = binary.LittleEndian
// TODO: automatically attempt to resync? Try every byte as a header_page, look for valid type IDs?
// Or just drop the page, mark lost events, and continue with the next page?
// Write to doneCh to end
func (f *ftrace) getEvents(cpu int, doneCh <-chan bool) (<-chan Events, error) {
func (f *Ftrace) getEvents(cpu int, doneCh <-chan bool) (<-chan Events, error) {
rawDoneCh := make(chan bool)
eventCh := make(chan Events)

Expand Down Expand Up @@ -88,7 +88,7 @@ func (f *ftrace) getEvents(cpu int, doneCh <-chan bool) (<-chan Events, error) {
return eventCh, nil
}

func (f *ftrace) decodePage(cpu int, data []byte) (events Events, err error) {
func (f *Ftrace) decodePage(cpu int, data []byte) (events Events, err error) {
page, err := f.pageHeader.DecodeEvent(data, 0, 0)
if err != nil {
return nil, err
Expand Down Expand Up @@ -197,7 +197,7 @@ dataLoop:
}

type Event struct {
ftrace *ftrace
ftrace *Ftrace
etype *EventType
values []eventFieldValue
Cpu int
Expand Down
4 changes: 2 additions & 2 deletions ftrace/eventtype.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"strconv"
"strings"

"traceout/ftrace/cparse"
"traceout/ftrace/cprintf"
"github.com/google/traceout/ftrace/cparse"
"github.com/google/traceout/ftrace/cprintf"
)

type EventType struct {
Expand Down
26 changes: 13 additions & 13 deletions ftrace/ftrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"
)

type ftrace struct {
type Ftrace struct {
fp FileProvider
eventTypes map[int]*EventType
selectCases []reflect.SelectCase
Expand All @@ -35,8 +35,8 @@ type ftrace struct {
pageHeaderFieldData int
}

func Ftrace(fp FileProvider) (*ftrace, error) {
f := &ftrace{
func New(fp FileProvider) (*Ftrace, error) {
f := &Ftrace{
fp: fp,
eventTypes: make(map[int]*EventType),
}
Expand All @@ -49,7 +49,7 @@ func Ftrace(fp FileProvider) (*ftrace, error) {
return f, nil
}

func (f *ftrace) init() error {
func (f *Ftrace) init() error {
var err error

f.pageHeader, err = NewHeaderType(f.fp, "events/header_page")
Expand All @@ -65,7 +65,7 @@ func (f *ftrace) init() error {
return nil
}

func (f *ftrace) NewEventType(path string) (*EventType, error) {
func (f *Ftrace) NewEventType(path string) (*EventType, error) {
etype, err := newEventType(f.fp, path)
if err != nil {
return nil, err
Expand All @@ -80,23 +80,23 @@ func (f *ftrace) NewEventType(path string) (*EventType, error) {
return etype, nil
}

func (f *ftrace) Enable() error {
func (f *Ftrace) Enable() error {
return f.fp.WriteFtraceFile("tracing_on", []byte("1"))
}

func (f *ftrace) Disable() error {
func (f *Ftrace) Disable() error {
return f.fp.WriteFtraceFile("tracing_on", []byte("0"))
}

func (f *ftrace) Clear() error {
func (f *Ftrace) Clear() error {
return f.fp.WriteFtraceFile("trace", []byte(""))
}

func (f *ftrace) ReadKernelTrace() ([]byte, error) {
func (f *Ftrace) ReadKernelTrace() ([]byte, error) {
return f.fp.ReadFtraceFile("trace")
}

func (f *ftrace) PrepareCapture(cpus int, doneCh <-chan bool) error {
func (f *Ftrace) PrepareCapture(cpus int, doneCh <-chan bool) error {
f.selectCases = []reflect.SelectCase{
reflect.SelectCase{
Dir: reflect.SelectRecv,
Expand All @@ -119,7 +119,7 @@ func (f *ftrace) PrepareCapture(cpus int, doneCh <-chan bool) error {
return nil
}

func (f *ftrace) Capture(callback func(Events)) {
func (f *Ftrace) Capture(callback func(Events)) {
eventArrayType := reflect.TypeOf(Events{})

for len(f.selectCases) > 1 {
Expand All @@ -138,7 +138,7 @@ func (f *ftrace) Capture(callback func(Events)) {
}
}

func (f *ftrace) processName(pid int) string {
func (f *Ftrace) processName(pid int) string {
if !f.isCachedProcessNames {
f.isCachedProcessNames = true
processNameFile, err := f.fp.ReadFtraceFile("saved_cmdlines")
Expand All @@ -162,7 +162,7 @@ func (f *ftrace) processName(pid int) string {
return f.cachedProcessNames[pid]
}

func (f *ftrace) kernelSymbol(addr uint64) string {
func (f *Ftrace) kernelSymbol(addr uint64) string {
if f.cachedKallsyms == nil {
f.cachedKallsyms = make(map[uint64]string)
// TODO: through fp
Expand Down
2 changes: 1 addition & 1 deletion ftrace/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package ftrace
import (
"strings"

"traceout/ftrace/cparse"
"github.com/google/traceout/ftrace/cparse"
)

type kernelFunc func(cparse.EvalContext, []cparse.Value) cparse.Value
Expand Down