Class: RbBCC::StackTrace
Constant Summary collapse
- MAX_DEPTH =
127
- BPF_F_STACK_BUILD_ID =
(1<<5)
- BPF_STACK_BUILD_ID_EMPTY =
can’t get stacktrace
0
- BPF_STACK_BUILD_ID_VALID =
valid build-id,ip
1
- BPF_STACK_BUILD_ID_IP =
fallback to ip
2
Instance Attribute Summary
Attributes inherited from TableBase
#bpf, #flags, #keysize, #keytype, #leafsize, #leaftype, #map_fd, #map_id, #name, #ttype
Instance Method Summary collapse
Methods inherited from TableBase
#[], #[]=, #clear, #delete, #each_key, #each_pair, #each_value, #fetch, #initialize, #items, #next, #print_linear_hist, #print_log2_hist, #structured_key?, #values
Methods included from CPUHelper
_read_cpu_range, get_online_cpus, get_possible_cpus
Constructor Details
This class inherits a constructor from RbBCC::TableBase
Instance Method Details
#get_stack(stack_id) ⇒ Object
453 454 455 456 |
# File 'lib/rbbcc/table.rb', line 453 def get_stack(stack_id) key = stack_id.is_a?(Fiddle::Pointer) ? stack_id : byref(stack_id, @keysize) leaftype.new(self[stack_id]) end |
#walk(stack_id, resolve: nil, &blk) ⇒ Object
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/rbbcc/table.rb', line 458 def walk(stack_id, resolve: nil, &blk) addrs = if (flags & BPF_F_STACK_BUILD_ID).nonzero? get_stack(stack_id).trace[0..MAX_DEPTH] else get_stack(stack_id).ip[0..MAX_DEPTH] end addrs.each do |addr| break if addr.zero? if resolve blk.call(resolve.call(addr)) else blk.call(addr) end end end |