Devel-NYTProf

 view release on metacpan or  search on metacpan

FileHandle.xs  view on Meta::CPAN

    total += retval = output_nv(ofile, excl_rtime);
    if (retval < 1)
        return retval;

    total += retval = output_nv(ofile, reci_rtime);
    if (retval < 1)
        return retval;

    total += retval = output_u32(ofile, depth);
    if (retval < 1)
        return retval;

    total += retval = output_str(ofile, called_name, called_name_len);
    if (retval < 1)
        return retval;

    return total;
}

size_t
NYTP_write_src_line(NYTP_file ofile, U32 fid,
                    U32 line, const char *text, I32 text_len)
{
    size_t total;
    size_t retval;

    total = retval = output_tag_u32(ofile, NYTP_TAG_SRC_LINE, fid);
    if (retval < 1)
        return retval;

    total += retval = output_u32(ofile, line);
    if (retval < 1)
        return retval;

    total += retval = output_str(ofile, text, text_len);
    if (retval < 1)
        return retval;

    return total;
}

size_t
NYTP_write_discount(NYTP_file ofile)
{
    const unsigned char tag = NYTP_TAG_DISCOUNT;
    return NYTP_write(ofile, &tag, sizeof(tag));
}


MODULE = Devel::NYTProf::FileHandle     PACKAGE = Devel::NYTProf::FileHandle    PREFIX = NYTP_

PROTOTYPES: DISABLE

void
open(pathname, mode)
char *pathname
char *mode
    PREINIT:
        NYTP_file fh = NYTP_open(pathname, mode);
        SV *object;
    PPCODE:
        if(!fh)
            XSRETURN(0);
        object = newSV(0);
        sv_usepvn(object, (char *) fh, sizeof(struct NYTP_file_t));
        ST(0) = sv_bless(sv_2mortal(newRV_noinc(object)), gv_stashpvs("Devel::NYTProf::FileHandle", GV_ADD));
        XSRETURN(1);

int
DESTROY(handle)
NYTP_file handle
    ALIAS:
        close = 1
    PREINIT:
        SV *guts;
    CODE:
	guts = SvRV(ST(0));
        PERL_UNUSED_VAR(ix);
        RETVAL = NYTP_close(handle, 0);
        SvPV_set(guts, NULL);
        SvLEN_set(guts, 0);
    OUTPUT:
        RETVAL

size_t
write(handle, string)
NYTP_file handle
SV *string
    PREINIT:
        STRLEN len;
        char *p;
    CODE:
        p = SvPVbyte(string, len);
        RETVAL = NYTP_write(handle, p, len);
    OUTPUT:
        RETVAL

#ifdef HAS_ZLIB

void
NYTP_start_deflate(handle, compression_level = 6)
NYTP_file handle
int compression_level

void
NYTP_start_deflate_write_tag_comment(handle, compression_level = 6)
NYTP_file handle
int compression_level

#endif

size_t
NYTP_write_comment(handle, comment)
NYTP_file handle
char *comment
    CODE:
        RETVAL = NYTP_write_comment(handle, "%s", comment);
    OUTPUT:
        RETVAL

size_t



( run in 0.623 second using v1.01-cache-2.11-cpan-71847e10f99 )