VIRTUTECH CONFIDENTIAL    Previous - Up - Next

branch_arc

Implemented By
branch_recorder
Description

Interface for getting branch arcs out profilers. The target is some kind of profiler whose data can be meaningfully viewed as branch arcs (usually a branch profiler).

iter returns a branch arc iterator that will visit all branch arcs in the range precisely once, in order of selected address (to or from, selected with dir), other address and type. In Python, it works just like any other iterator, and returns (from, to, counter, type) tuples. Note that you may not continue to use the iterator after the underlying profiler has been modified.

branch_arc_type_t defines the branch types returned by a branch arc iterator.

Branch_Arc_Branch
Normal branch operation
Branch_Arc_Exception
Branch because an exception was encountered
Branch_Arc_Exception_Return
Branch to finish an exception handler

typedef enum {
        Branch_Arc_Branch,
        Branch_Arc_Exception,
        Branch_Arc_Exception_Return,
        Branch_Arc_Max
} branch_arc_type_t;
typedef enum {
        BR_Direction_From,
        BR_Direction_To
} branch_recorder_direction_t;
typedef struct {
        uinteger_t addr_from;
        uinteger_t addr_to;
        integer_t count;
        branch_arc_type_t type;
} branch_arc_t;

typedef struct branch_arc_iter {
        branch_arc_t *(*next)(struct branch_arc_iter *i);
        void (*destroy)(struct branch_arc_iter *i);
} branch_arc_iter_t; 

typedef struct branch_arc_interface {
        branch_arc_iter_t *(*iter)(conf_object_t *prof_obj,
                                   generic_address_t start,
                                   generic_address_t stop,
                                   branch_recorder_direction_t dir);
} branch_arc_interface_t;

#define BRANCH_ARC_INTERFACE "branch_arc"

VIRTUTECH CONFIDENTIAL    Previous - Up - Next