Class: AppProfiler::Backend::BaseBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/app_profiler/backend/base_backend.rb

Direct Known Subclasses

StackprofBackend, VernierBackend

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.nameObject

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/app_profiler/backend/base_backend.rb', line 50

def name
  raise NotImplementedError
end

.run_lockObject



46
47
48
# File 'lib/app_profiler/backend/base_backend.rb', line 46

def run_lock
  @run_lock ||= Mutex.new
end

Instance Method Details

#resultsObject

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/app_profiler/backend/base_backend.rb', line 37

def results
  raise NotImplementedError
end

#run(params = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/app_profiler/backend/base_backend.rb', line 6

def run(params = {})
  started = start(params)
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  yield

  return unless started

  duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time

  stop
  results_data = results

  if results_data
    results_data.[:duration] = duration
  end

  results_data
ensure
  # Only stop the profiler if profiling was started in this context.
  stop if started
end

#running?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/app_profiler/backend/base_backend.rb', line 41

def running?
  raise NotImplementedError
end

#start(params = {}) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/app_profiler/backend/base_backend.rb', line 29

def start(params = {})
  raise NotImplementedError
end

#stopObject

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/app_profiler/backend/base_backend.rb', line 33

def stop
  raise NotImplementedError
end