module BOAST::PAPIProbe

@private

Public Instance Methods

compute() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 225
def compute
end
configure() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 203
    def configure
      get_output.print <<EOF
  _boast_get_papi_envent_set( _boast_rb_opts, &_boast_papi );
EOF
    end
decl() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 197
    def decl
      get_output.print <<EOF
  struct _boast_papi_struct _boast_papi = { Qnil, Qnil };
EOF
    end
header() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 152
def header
end
name() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 148
def name
  return "PAPI"
end
preamble() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 155
    def preamble
      get_output.print <<EOF
struct _boast_papi_struct {
  VALUE event_set;
  VALUE results;
};

static void _boast_get_papi_envent_set( VALUE _boast_rb_opts, struct _boast_papi_struct *_boast_papi );
static void _boast_get_papi_envent_set( VALUE _boast_rb_opts, struct _boast_papi_struct *_boast_papi ) {
  VALUE _boast_event_set = Qnil;
  if( _boast_rb_opts != Qnil ) {
     VALUE _boast_PAPI_rb_ptr = Qnil;
    _boast_PAPI_rb_ptr = rb_hash_aref(_boast_rb_opts, ID2SYM(rb_intern("PAPI")));
    if( _boast_PAPI_rb_ptr != Qnil ) {
      VALUE _boast_PAPI = Qnil;
      VALUE _boast_EventSet = Qnil;
      _boast_PAPI =  rb_const_get(rb_cObject, rb_intern("PAPI"));
      _boast_EventSet =  rb_const_get(_boast_PAPI, rb_intern("EventSet"));
      _boast_event_set = rb_funcall(_boast_EventSet, rb_intern("new"), 0);
      rb_funcall(_boast_event_set, rb_intern("add_named"), 1, _boast_PAPI_rb_ptr);
    }
  }
  _boast_papi->event_set = _boast_event_set;
}

static void _boast_store_papi_results( struct _boast_papi_struct *_boast_papi, VALUE _boast_rb_opts, VALUE _boast_stats );
static void _boast_store_papi_results( struct _boast_papi_struct *_boast_papi, VALUE _boast_rb_opts, VALUE _boast_stats ) {
  if( _boast_papi->results != Qnil) {
    VALUE _boast_papi_stats = Qnil;
    _boast_papi_stats = rb_ary_new3(1,rb_hash_aref(_boast_rb_opts, ID2SYM(rb_intern("PAPI"))));
    _boast_papi_stats = rb_funcall(_boast_papi_stats, rb_intern("flatten"), 0);
    _boast_papi_stats = rb_funcall(_boast_papi_stats, rb_intern("zip"), 1, _boast_papi->results);
    _boast_papi->results = rb_funcall(rb_const_get(rb_cObject, rb_intern("Hash")), rb_intern("send"), 2, ID2SYM(rb_intern("[]")), _boast_papi_stats );
    rb_hash_aset(_boast_stats, ID2SYM(rb_intern(\"PAPI\")), _boast_papi->results);
    rb_funcall(_boast_papi->event_set, rb_intern("cleanup"), 0);
    rb_funcall(_boast_papi->event_set, rb_intern("destroy"), 0);
  }
}

EOF
    end
start() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 209
    def start
      get_output.print <<EOF
  if( _boast_papi.event_set != Qnil) {
    rb_funcall(_boast_papi.event_set, rb_intern("start"), 0);
  }
EOF
    end
stop() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 217
    def stop
      get_output.print <<EOF
  if( _boast_papi.event_set != Qnil) {
    _boast_papi.results = rb_funcall(_boast_papi.event_set, rb_intern("stop"), 0);
  }
EOF
    end
store() click to toggle source
# File lib/BOAST/Runtime/Probe.rb, line 228
    def store
      get_output.print <<EOF
  _boast_store_papi_results( &_boast_papi, _boast_rb_opts, _boast_stats );
EOF
    end