예제 #1
0
파일: state.go 프로젝트: egonelbre/spector
func NewView(state *State, context *ui.Context, timeline *timeline.Timeline) *View {
	ui := &View{}
	ui.State = state
	ui.Timeline = timeline
	ui.Context = context
	ui.Size = context.Area.Size()

	ui.Start = 0
	ui.Stop = 1e5
	if len(timeline.Procs) > 0 {
		ui.Stop = timeline.Procs[0].Time
	}
	ui.Span = ui.Stop - ui.Start

	ui.TimePerPx = ui.Span / trace.Time(context.Area.Dx())
	return ui
}
예제 #2
0
func (stream *Stream) advanceTime(amount int32) trace.Time {
	return trace.Time(atomic.AddInt32(&stream.time, amount))
}