Example #1
0
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
}
Example #2
0
func (stream *Stream) advanceTime(amount int32) trace.Time {
	return trace.Time(atomic.AddInt32(&stream.time, amount))
}