B-Stats

 view release on metacpan or  search on metacpan

Stats.xs  view on Meta::CPAN

  DEBUG_v(Perl_deb(aTHX_ "leaving RUNOPS level (B::Stats)\n"));

  TAINT_NOT;
  return 0;
}

void
reset_rcount() {
#if 1
  memset(opcount, 0, sizeof(opcount));
#else
  register int i;
  for (i=0; i < MAXO; i++) {
    opcount[i] = 0;
  }
#endif
}
/* returns an SV ref to AV with caller now owning the SV ref */
SV *
rcount_all(pTHX) {
  AV * av;
  int i;
  av = newAV();
  for (i=0; i < MAXO; i++) {
    av_store(av, i, newSViv(opcount[i]));
  }
  return newRV_noinc((SV*)av);
}

MODULE = B::Stats  PACKAGE = B::Stats

PROTOTYPES: DISABLE

U32
rcount(opcode)
	IV opcode
  CODE:
	RETVAL = opcount[opcode];
  OUTPUT:
	RETVAL

SV *
rcount_all()
  C_ARGS:
    aTHX

void
reset_rcount()

void
_xs_collect_env()
  CODE:
	/* walk stashes in C and store in %B_env before B is loaded,
	   to be able to detect if our testfunc loads B and its 14 deps itself.
	 */

void
END(...)
  PREINIT:
    SV * sv;
  PPCODE:
    PUSHMARK(SP);
    PUSHs(sv_2mortal(rcount_all(aTHX)));
    PUTBACK;
    call_pv("B::Stats::_end", G_VOID);
    return; /* skip implicity PUTBACK */

void
INIT(...)
  PPCODE:
    PUTBACK;
    reset_rcount();
    return; /* skip implicity PUTBACK */

BOOT:
{
  reset_rcount();
  PL_runops = my_runops;
}



( run in 2.155 seconds using v1.01-cache-2.11-cpan-71847e10f99 )