7 Simulator-to-Simulator Interfaces branch_arc
API Reference Manual  /  7 Simulator-to-Simulator Interfaces  / 

address_profiler

Description
Interface for getting statistics out of profilers. The target is some kind of profiler whose data can be meaningfully viewed as counts per address.

The function num_views returns the number k of different ways you can view the data of this object. The view selection parameter view to all other functions in the interface accepts values between 0 and k − 1.

description returns a short string that explains what the data means. physical_addresses returns true if the profiler works with physical addresses, or false if it uses virtual addresses. address_bits returns the number of bits in an address.

granularity_log2 returns the base 2 logarithm of the size, in bytes, of the address intervals that the counters are associated to. For example, if the data is instruction execution count and each instruction is 4 bytes long, one would expect the granularity to be at least 4 bytes since that is the smallest interval containing a whole instruction (but it might be more, if the profiler is less fine-grained for some reason). And for a 4-byte granularity, granularity_log2 would return 2.

sum returns the sum of all counters between start and stop, inclusive. max returns the maximum value of any counter in the range.

iter returns an address profile iterator that will visit all nonzero counters in the range precisely once, in some order. In C, you can use the functions SIM_iter_next, SIM_iter_addr and SIM_iter_free to operate the iterator. In Python, it works just like any other iterator, and returns (count, address) pairs. Note that you may not continue to use the iterator after the underlying address profiler has been modified.

SIM_INTERFACE(address_profiler) {
        addr_prof_iter_t *(*iter)(conf_object_t *prof_obj, unsigned view,
                                  generic_address_t start,
                                  generic_address_t stop);
        uint64 (*sum)(conf_object_t *prof_obj, unsigned view,
                      generic_address_t start, generic_address_t end);
        uint64 (*max)(conf_object_t *prof_obj, unsigned view,
                      generic_address_t start, generic_address_t end);
        unsigned (*granularity_log2)(conf_object_t *prof_obj, unsigned view);
        int (*address_bits)(conf_object_t *prof_obj, unsigned view);
        int (*physical_addresses)(conf_object_t *prof_obj, unsigned view);
        const char *(*description)(conf_object_t *prof_obj, unsigned view);
        unsigned (*num_views)(conf_object_t *prof_obj);
};

#define ADDRESS_PROFILER_INTERFACE "address_profiler"

Execution Context
Cell Context for all methods.

7 Simulator-to-Simulator Interfaces branch_arc