Interface Clock

interface Clock {
    disable(): void;
    disableAutoReset(): void;
    enable(): void;
    enableAutoReset(): void;
    getCurrentEvent(): null | ClockEvent;
    getEvents(): ClockEvent[];
    read(): bigint;
    reset(): void;
    setCurrentEvent(event: string | number): void;
}

Methods

  • Disable the profile clock

    Returns void

    Will throw if profile clock cannot be disabled.

    session.clock.disable();
    
  • Disable Auto-Reset mode for the profile clock.

    Returns void

    session.clock.disableAutoReset();
    
  • Enable the profile clock

    Returns void

    Will throw if profile clock cannot be enabled.

    session.clock.enable();
    
  • Enable Auto-Reset mode for the profile clock.

    Returns void

    session.clock.enableAutoReset();
    
  • Get the currently configured profile clock event.

    Returns null | ClockEvent

    The currently configured profile clock event.

    Returns null if the profile clock is not configured for a valid event

    const event = session.clock.getCurrentEvent();
    if (event) {
    console.log(`The clock is currently profiling ${event.name}`);
    } else {
    console.log(`The clock is not currently profiling an event`);
    }
  • Get a list of all available profile clock events

    Returns ClockEvent[]

    A list of all available profile clock events.

    const events = session.clock.getEvents();
    for( const event of events ) {
    console.log( `${event.id}: ${event.name}` );
  • Read the current value of the profile clock counter.

    Returns bigint

    The current value of the profile clock

    const count = session.clock.read();
    
  • Reset the profile clock counter to zero.

    Returns void

    session.clock.reset();
    
  • Configure the profile clock to profile/count a particular event.

    Parameters

    • event: string | number

      The id or name of the event to profile.

    Returns void

    Will throw if it is not possible to configure the profile clock for this event.

    // by id
    session.clock.setCurrentEvent( 1 );
    // by name (this is just an example, events differ by target)
    session.clock.setCurrentEvent( "CPU.discontinuity.branch" );