Skip to content

File ns_perf_profile.c

FileList > neuralSPOT > neuralspot > ns-utils > src > ns_perf_profile.c

Go to the source code of this file

Collection of performance and power profiling utilities. More...

  • #include "ns_perf_profile.h"
  • #include "ns_ambiqsuite_harness.h"

Public Functions

Type Name
uint8_t ns_cache_profiler_init (ns_cache_config_t * cfg)
Initialize the cache profiler.
void ns_capture_cache_stats (ns_cache_dump_t * dump)
Capture the current value of the cache performance counters in the provided struct.
void ns_capture_perf_profiler (ns_perf_counters_t * c)
Capture the current value of the HW performance counters in the provided struct.
void ns_delta_cache (ns_cache_dump_t * s, ns_cache_dump_t * e, ns_cache_dump_t * d)
Capture the delta between two cache performance counter snapshots.
void ns_delta_perf (ns_perf_counters_t * s, ns_perf_counters_t * e, ns_perf_counters_t * d)
Calculate the delta between two HW performance snapshots.
void ns_init_perf_profiler (void)
Configure the HW performance capture unit.
void ns_print_cache_stats (ns_cache_dump_t * dump)
Print the cache performance counters.
void ns_print_cache_stats_delta (ns_cache_dump_t * start, ns_cache_dump_t * end)
Print the delta between two cache performance counter snapshots.
void ns_print_perf_profile (ns_perf_counters_t * c)
Print a HW performance counter snapshot.
void ns_reset_perf_counters (void)
Reset the HW performance counters.
void ns_start_perf_profiler (void)
Start the HW performance capture unit.
void ns_stop_perf_profiler (void)
Stop the HW performance capture unit.

Public Static Functions

Type Name
uint32_t ns_delta_byte_counter_wrap (uint32_t e, uint32_t s)

Detailed Description

Author:

Carlos Morales

Version:

0.1

Date:

2022-10-10

Copyright:

Copyright (c) 2022

Public Functions Documentation

function ns_cache_profiler_init

Initialize the cache profiler.

uint8_t ns_cache_profiler_init (
    ns_cache_config_t * cfg
) 

Parameters:

  • cfg Configuration struct

Returns:

uint8_t

Initialize the cache profiler.

Enables cache performance counters (uses slightly more power)

Parameters:

  • cfg

Returns:

uint8_t

function ns_capture_cache_stats

Capture the current value of the cache performance counters in the provided struct.

void ns_capture_cache_stats (
    ns_cache_dump_t * dump
) 

Parameters:

  • dump

Capture the current value of the cache performance counters in the provided struct.

Parameters:

  • dump

function ns_capture_perf_profiler

Capture the current value of the HW performance counters in the provided struct.

void ns_capture_perf_profiler (
    ns_perf_counters_t * c
) 

Parameters:

  • c

Capture the current value of the HW performance counters in the provided struct.

Parameters:

  • c

function ns_delta_cache

Capture the delta between two cache performance counter snapshots.

void ns_delta_cache (
    ns_cache_dump_t * s,
    ns_cache_dump_t * e,
    ns_cache_dump_t * d
) 

Parameters:

  • s start snapshot
  • e end snapshot
  • d struct where delta will be stored

function ns_delta_perf

Calculate the delta between two HW performance snapshots.

void ns_delta_perf (
    ns_perf_counters_t * s,
    ns_perf_counters_t * e,
    ns_perf_counters_t * d
) 

Parameters:

  • s starting snapshot
  • e ending snapshot
  • d Calculated delta

function ns_init_perf_profiler

Configure the HW performance capture unit.

void ns_init_perf_profiler (
    void
) 

Configure the HW performance capture unit.

function ns_print_cache_stats

Print the cache performance counters.

void ns_print_cache_stats (
    ns_cache_dump_t * dump
) 

Parameters:

  • dump

Print the cache performance counters.

Parameters:

  • dump

function ns_print_cache_stats_delta

Print the delta between two cache performance counter snapshots.

void ns_print_cache_stats_delta (
    ns_cache_dump_t * start,
    ns_cache_dump_t * end
) 

Parameters:

  • start
  • end

Print the delta between two cache performance counter snapshots.

Parameters:

  • start
  • end

function ns_print_perf_profile

Print a HW performance counter snapshot.

void ns_print_perf_profile (
    ns_perf_counters_t * c
) 

Parameters:

  • c

Print a HW performance counter snapshot.

Parameters:

  • c

function ns_reset_perf_counters

Reset the HW performance counters.

void ns_reset_perf_counters (
    void
) 

Reset the HW performance counters.

function ns_start_perf_profiler

Start the HW performance capture unit.

void ns_start_perf_profiler (
    void
) 

Start the HW performance capture unit.

function ns_stop_perf_profiler

Stop the HW performance capture unit.

void ns_stop_perf_profiler (
    void
) 

Stop the HW performance capture unit.

Public Static Functions Documentation

function ns_delta_byte_counter_wrap

static uint32_t ns_delta_byte_counter_wrap (
    uint32_t e,
    uint32_t s
) 

The documentation for this class was generated from the following file neuralSPOT/neuralspot/ns-utils/src/ns_perf_profile.c