Module: Perfetto

Defined in:
lib/perfetto.rb,
lib/perfetto/version.rb,
lib/perfetto/perfetto.rb,
lib/perfetto/configure.rb,
lib/perfetto/middleware.rb,
lib/perfetto/interceptor.rb,
ext/perfetto/perfetto.c

Overview

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength

Defined Under Namespace

Modules: Interceptor Classes: Configure, Middleware

Constant Summary collapse

VERSION =
"0.1.16"

Class Method Summary collapse

Class Method Details

.fiber_trace_event_begin(category, name) ⇒ Object Also known as: trace_event_begin



88
89
90
91
92
# File 'ext/perfetto/perfetto.c', line 88

static VALUE rb_perfetto_fiber_trace_event_begin(VALUE self, VALUE category, VALUE name)
{
    perfetto_fiber_trace_event_begin(StringValuePtr(category), StringValuePtr(name), current_fiber_object_id());
    return Qnil;
}

.fiber_trace_event_begin_with_debug_info(category, name, debug_info_key, debug_info_value) ⇒ Object Also known as: trace_event_begin_with_debug_info



112
113
114
115
116
# File 'ext/perfetto/perfetto.c', line 112

static VALUE rb_perfetto_fiber_trace_event_begin_with_debug_info(VALUE self, VALUE category, VALUE name, VALUE debug_info_key, VALUE debug_info_value)
{
    perfetto_fiber_trace_event_begin_with_debug_info(StringValuePtr(category), StringValuePtr(name), StringValuePtr(debug_info_key), StringValuePtr(debug_info_value), current_fiber_object_id());
    return Qnil;
}

.fiber_trace_event_end(category) ⇒ Object Also known as: trace_event_end



94
95
96
97
98
# File 'ext/perfetto/perfetto.c', line 94

static VALUE rb_perfetto_fiber_trace_event_end(VALUE self, VALUE category)
{
    perfetto_fiber_trace_event_end(StringValuePtr(category), current_fiber_object_id());
    return Qnil;
}

.fiber_trace_event_instant(category, name) ⇒ Object Also known as: trace_event_instant



100
101
102
103
104
# File 'ext/perfetto/perfetto.c', line 100

static VALUE rb_perfetto_fiber_trace_event_instant(VALUE self, VALUE category, VALUE name)
{
    perfetto_fiber_trace_event_instant(StringValuePtr(category), StringValuePtr(name), current_fiber_object_id());
    return Qnil;
}

.fiber_trace_event_instant_with_debug_info(category, name, debug_info_key, debug_info_value) ⇒ Object Also known as: trace_event_instant_with_debug_info



106
107
108
109
110
# File 'ext/perfetto/perfetto.c', line 106

static VALUE rb_perfetto_fiber_trace_event_instant_with_debug_info(VALUE self, VALUE category, VALUE name, VALUE debug_info_key, VALUE debug_info_value)
{
    perfetto_fiber_trace_event_instant_with_debug_info(StringValuePtr(category), StringValuePtr(name), StringValuePtr(debug_info_key), StringValuePtr(debug_info_value), current_fiber_object_id());
    return Qnil;
}

.setup(enable_tracing: nil, enable_fiber: nil, buffer_size_kb: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/perfetto.rb', line 18

def self.setup(enable_tracing: nil, enable_fiber: nil, buffer_size_kb: nil)
  Configure.enable_tracing = enable_tracing unless enable_tracing.nil?
  Configure.enable_fiber = enable_fiber unless enable_fiber.nil?
  Configure.buffer_size_kb = buffer_size_kb unless buffer_size_kb.nil?

  # Native extension
  require_relative "perfetto/perfetto_native"
  # Ruby wrapper
  require_relative "perfetto/perfetto"
  # Instrumentation Helper
  require_relative "perfetto/interceptor"
end

.start_tracing(buffer_size_kb) ⇒ Object

Methods



29
30
31
# File 'lib/perfetto/perfetto.rb', line 29

def self.start_tracing
  start_tracing_native Configure.buffer_size_kb
end

.start_tracing_nativeObject



6
# File 'lib/perfetto/perfetto.rb', line 6

alias start_tracing_native start_tracing

.stop_tracing(output_file) ⇒ Object



17
18
19
# File 'ext/perfetto/perfetto.c', line 17

def self.stop_tracing(trace_file_name = "#{Time.now.strftime("%Y%m%d-%H-%M-%S")}.pftrace")
  stop_tracing_native trace_file_name
end

.stop_tracing_nativeObject



7
# File 'lib/perfetto/perfetto.rb', line 7

alias stop_tracing_native stop_tracing

.thread_trace_event_beginObject

Replace thread based methods with fiber based methods



14
# File 'lib/perfetto/perfetto.rb', line 14

alias thread_trace_event_begin trace_event_begin

.thread_trace_event_begin_with_debug_infoObject



17
# File 'lib/perfetto/perfetto.rb', line 17

alias thread_trace_event_begin_with_debug_info trace_event_begin_with_debug_info

.thread_trace_event_endObject



15
# File 'lib/perfetto/perfetto.rb', line 15

alias thread_trace_event_end trace_event_end

.thread_trace_event_instantObject



16
# File 'lib/perfetto/perfetto.rb', line 16

alias thread_trace_event_instant trace_event_instant

.thread_trace_event_instant_with_debug_infoObject



18
# File 'lib/perfetto/perfetto.rb', line 18

alias thread_trace_event_instant_with_debug_info trace_event_instant_with_debug_info

.trace_counter(category, name, value) ⇒ Object



64
# File 'ext/perfetto/perfetto.c', line 64

def self.trace_counter(_class_name, _counter_name, _counter_value); end

.trace_counter_double(category, name, value) ⇒ Object



40
# File 'ext/perfetto/perfetto.c', line 40

def self.trace_counter_double(_class_name, _counter_name, _counter_value); end

.trace_counter_i64(category, name, value) ⇒ Object



34
# File 'ext/perfetto/perfetto.c', line 34

def self.trace_counter_i64(_class_name, _counter_name, _counter_value); end