Push pushes a new event to the queue.
(e *Event)
| 85 | |
| 86 | // Push pushes a new event to the queue. |
| 87 | func (s *StackwalkDecorator) Push(e *Event) { |
| 88 | s.mux.Lock() |
| 89 | defer s.mux.Unlock() |
| 90 | |
| 91 | // the process is created on behalf of brokered |
| 92 | // process and the callstack return addresses |
| 93 | // need to be obtained from the surrogate process |
| 94 | if e.IsSurrogateProcess() { |
| 95 | s.procs[e.Params.MustGetPid()] = e |
| 96 | } |
| 97 | |
| 98 | // append the event to the bucket indexed by stack id |
| 99 | id := e.StackID() |
| 100 | q, ok := s.buckets[id] |
| 101 | if !ok { |
| 102 | s.buckets[id] = []*Event{e} |
| 103 | } else { |
| 104 | s.buckets[id] = append(q, e) |
| 105 | } |
| 106 | |
| 107 | stackwalkBuckets.Set(int64(len(s.buckets))) |
| 108 | stackwalkEnqueued.Add(int64(len(s.buckets[id]))) |
| 109 | } |
| 110 | |
| 111 | // Pop receives the stack walk event and pops the oldest |
| 112 | // originating event with the same pid,tid tuple formerly |