Class FlattenedRangeAnalyzer

Class Documentation

class FlattenedRangeAnalyzer

Utility that allows finding calls from a flattened range in the stream.

Public Types

enum class Rounding

Values:

enumerator ROUND_UP
enumerator ROUND_DOWN

The callable returned is the closest matched one after the given timestamp.

The callable returned is the closest matched one before the given timestamp.

enumerator EXACT_MATCH

The timestamp much exactly match the callable for an index to be returned.

Public Functions

FlattenedRangeAnalyzer(CallableCache *flattenedCache, StreamData *streamData)
uint64_t SearchRangeForCallFromStream(uint64_t absoluteCallIndex)

Translates absolute stream index of a call to index of the same call in provided flattened range.

Returns

Index of the call in the range. Returns UINT64_MAX, if not found.

uint64_t SearchRangeForCallFromStream(uint64_t timestamp, uint64_t storageID, Rounding rounding = Rounding::ROUND_UP)

Given a timestamp and storage ID, return the index of the most closely matched corresponding callable in the flattened range.

Parameters
  • timestamp -- The timestamp of the callable.

  • storageID -- The ID of the thread the callable was created on, which corresponds to the Callable's storage ID. Note that this value is not necessarily equivalent to the native thread ID; in the case of macOS, threads are assigned by the capture layer an incrementing unique index.

  • rounding -- Specifies the rounding strategy when searching for a callable near the given timestamp. The default behavior is to return the nearest callable as if the timestamp were "rounded up." That is, the closest callable on the matching thread with a timestamp above the given timestamp will be returned.

Returns

Index of the call in the range. Returns UINT64_MAX if not found.