FastProf.xs

filter: Statementstmt 0.0% 0 / 281 Branchbran 0.0% 0 / 116 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 397 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Devel/FastProf/Reader.pm ↑ Summary
1 /* -*- Mode: C -*- */
2  
3 #define PERL_NO_GET_CONTEXT 1
4  
5 #include "EXTERN.h"
6 #include "perl.h"
7 #include "XSUB.h"
8  
9 #include "ppport.h"
10  
11 #include <string.h>
12 #include <stdio.h>
13 #include <sys/file.h>
14 #include <sys/types.h>
15 #include <unistd.h>
16  
17 static FILE *out = 0;
18 static char *outname;
19  
20 static HV *file_id_hv;
21  
22 #if defined (HAS_GETTIMEOD)
23 static struct timeval old_time;
24 #else
25 static UV old_time[2];
26 static int (*u2time)(pTHX_ UV *) = 0;
27 #endif
28  
29 static struct tms old_tms;
30 static int usecputime = 1;
31 static int canfork = 0;
32  
33 static char *old_fn = "";
34 static IV old_line = 0;
35  
36  
37 #define putmark(mark) putc(-(mark), out)
38 #define putpvn(str, len) { putiv(aTHX_ (len)); fwrite((str), 1, (len), out); }
39 #define putpv(str) { STRLEN len = strlen((str)); putpvn((str), len); }
40 #define put0() putc(0, (out))
41  
42 #if !defined(OutCopFILE)
43 #define OutCopFILE CopFILE
44 #endif
45  
46 /* some kind of huffman encoding for numbers */
47  
48 static void
49 0 _putiv(pTHX_ U32 n) {
50 0 n-=128;
51 0 ▶ if (n < 16384) {
Branch: 1 branch
BranchTrueFalseTotal
if (n < 16384) { 0 0 0
52 0 putc((n>>8) | 0x80, out);
53 0 putc(n & 0xff, out);
54 }
55 else {
56 0 n -= 16384;
57 0 ▶ if (n < 2097152) {
Branch: 1 branch
BranchTrueFalseTotal
if (n < 2097152) { 0 0 0
58 0 putc((n>>16) | 0xc0, out);
59 0 putc((n>>8) & 0xff, out);
60 0 putc(n & 0xff, out);
61 }
62 else {
63 0 n -= 2097152;
64 0 ▶ if (n < 268435456) {
Branch: 1 branch
BranchTrueFalseTotal
if (n < 268435456) { 0 0 0
65 0 putc((n>>24) | 0xe0, out);
66 0 putc((n>>16) & 0xff, out);
67 0 putc((n>>8) & 0xff, out);
68 0 putc(n & 0xff, out);
69 }
70 else {
71 0 n -= 268435456;
72 0 putc(0xf0, out);
73 0 putc((n>>24), out);
74 0 putc((n>>16) & 0xff, out);
75 0 putc((n>>8) & 0xff, out);
76 0 putc(n & 0xff, out);
77 }
78 }
79 }
80 0 }
81  
82 static void
83 0 putiv(pTHX_ I32 i32) {
84 0 U32 n = (U32)i32;
85 0 ▶ if (n < 128)
Branch: 1 branch
BranchTrueFalseTotal
if (n < 128) 0 0 0
86 0 putc(n, out);
87 else
88 0 _putiv(aTHX_ n);
89 0 }
90  
91 static void
92 0 putav(pTHX_ AV *av) {
93 0 UV nl = av_len(av)+1;
94 UV i;
95 0 putiv(aTHX_ nl);
96 0 ▶ for (i=0; i<nl; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i=0; i<nl; i++) { 0 0 0
97 0 SV **psv = av_fetch(av, i, 0);
98 STRLEN ll;
99 char *data;
100 0 ▶ if (psv) {
Branch: 1 branch
BranchTrueFalseTotal
if (psv) { 0 0 0
101 0 data = SvPV(*psv, ll);
102 0 putpvn(data, ll);
103 }
104 else {
105 0 put0();
106 }
107 }
108 0 }
109  
110 static IV
111 0 fgetiv(pTHX_ FILE *in) {
112 0 int c0 = getc(in);
113 0 ▶ if (c0 < 128) {
Branch: 1 branch
BranchTrueFalseTotal
if (c0 < 128) { 0 0 0
114 0 ▶ if (c0 < 0) croak ("unexpected end of file");
Branch: 1 branch
BranchTrueFalseTotal
if (c0 < 0) croak ("unexpected end of file"); 0 0 0
115 0 return c0;
116 }
117 else {
118 0 int c1 = getc(in);
119 0 ▶ if (c0 < 192) {
Branch: 1 branch
BranchTrueFalseTotal
if (c0 < 192) { 0 0 0
120 0 return 128 + c1 + ((c0 & 0x3f) << 8);
121 }
122 else {
123 0 int c2 = getc(in);
124 0 ▶ if (c0 < 224) {
Branch: 1 branch
BranchTrueFalseTotal
if (c0 < 224) { 0 0 0
125 0 return (128 + 16384) + c2 + ((c1 + ((c0 & 0x1f) << 8)) << 8);
126 }
127 else {
128 0 int c3 = getc(in);
129 0 ▶ if (c0 < 240) {
Branch: 1 branch
BranchTrueFalseTotal
if (c0 < 240) { 0 0 0
130 0 return (128 + 16384 + 2097152) + c3 + ((c2 + ((c1 + ((c0 & 0x0f) << 8)) << 8)) << 8);
131 }
132 else {
133 0 int c4 = getc(in);
134 0 ▶ if (c0 == 240) {
Branch: 1 branch
BranchTrueFalseTotal
if (c0 == 240) { 0 0 0
135 0 return (128 + 16384 + 2097152 + 268435456) + c4 + ((c3 + ((c2 + (c1 << 8)) << 8)) << 8);
136 }
137 else {
138 0 Perl_croak(aTHX_ "bad file format");
139 }
140 }
141 }
142 }
143 }
144 }
145  
146 static char
147 0 fgetmark(pTHX_ FILE *in) {
148 0 int c = getc(in);
149 0 ▶ if (c < 240) {
Branch: 1 branch
BranchTrueFalseTotal
if (c < 240) { 0 0 0
150 0 ungetc(c, in);
151 0 return 0;
152 }
153 0 return ((-c) & 0x0f);
154 }
155  
156 0 static void psv(SV *sv) {
157 dTHX;
158 0 Perl_sv_dump(aTHX_ sv);
159 0 }
160  
161 static SV *
162 0 _fgetpvn(pTHX_ FILE *in, IV len) {
163 0 ▶ if (len) {
Branch: 1 branch
BranchTrueFalseTotal
if (len) { 0 0 0
164 0 SV *sv = newSV(len);
165 0 char *buffer = SvPVX(sv);
166 0 int count = fread(buffer, 1, len, in);
167 0 ▶ if (count < len) {
Branch: 1 branch
BranchTrueFalseTotal
if (count < len) { 0 0 0
168 0 SvREFCNT_dec(sv);
169 0 Perl_croak(aTHX_ "unexpected end of file");
170 }
171 0 buffer[len] = '\0';
172 0 SvPOK_on(sv);
173 0 SvCUR_set(sv, len);
174 0 return sv;
175 }
176 0 return newSVpvn("", 0);
177 }
178  
179 static SV *
180 0 fgetpv(pTHX_ FILE *in) {
181 0 return _fgetpvn(aTHX_ in, fgetiv(aTHX_ in));
182 }
183  
184 static AV*
185 0 fgetav(pTHX_ FILE *in) {
186 0 AV *av = newAV();
187 0 IV lines = fgetiv(aTHX_ in);
188 IV i;
189 0 ▶ for (i=0; i<lines; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for (i=0; i<lines; i++) { 0 0 0
190 0 SV *sv = fgetpv(aTHX_ in);
191 0 av_store(av, i, sv);
192 }
193 0 return av;
194 }
195  
196 static int
197 0 fneof(FILE *in) {
198 0 int c = getc(in);
199 0 ▶ if (c != EOF) {
Branch: 1 branch
BranchTrueFalseTotal
if (c != EOF) { 0 0 0
200 0 ungetc(c, in);
201 0 return 1;
202 }
203 0 return 0;
204 }
205  
206 static AV *
207 0 get_file_src(pTHX_ char *fn) {
208 char *avname;
209 AV *lines;
210 0 SV *src = newSVpv("main::_<", 8);
211  
212 0 sv_catpv(src, fn);
213 0 avname = SvPV_nolen(src);
214 0 lines = get_av(avname, 0);
215 0 SvREFCNT_dec(src);
216 0 return lines;
217 }
218  
219 static UV
220 0 get_file_id(pTHX_ char *fn) {
221 static IV file_id_generator = 0;
222 SV ** pe;
223 UV id;
224 0 STRLEN fnl = strlen(fn);
225  
226 0 pe = hv_fetch(file_id_hv, fn, fnl, TRUE);
227 0 ▶ if (SvOK(*pe))
Branch: 1 branch
BranchTrueFalseTotal
if (SvOK(*pe)) 0 0 0
228 0 return SvUV(*pe);
229  
230 0 ++file_id_generator;
231
232 0 putmark(1);
233 0 putiv(aTHX_ file_id_generator);
234 0 putpvn(fn, fnl);
235
236 0 sv_setiv(*pe, file_id_generator);
237  
238 0 ▶ if ((fn[0] == '(' && (strncmp("eval", fn+1, 4)==0 ||
Branch: 2 branches
BranchTrueFalseTotal
if ((fn[0] == '(' && (strncmp("eval", fn+1, 4)==0 || 0 0 0
if ((fn[0] == '(' && (strncmp("eval", fn+1, 4)==0 || 0 0 0
239 0 ▶ strncmp("re_eval", fn+1, 7)==0 ) ) ||
Branch: 1 branch
BranchTrueFalseTotal
strncmp("re_eval", fn+1, 7)==0 ) ) || 0 0 0
240 0 ▶ (fn[0] == '-' && fn[1] == 'e' && fn[2] == '\0')) {
Branch: 3 branches
BranchTrueFalseTotal
(fn[0] == '-' && fn[1] == 'e' && fn[2] == '\0')) { 0 0 0
(fn[0] == '-' && fn[1] == 'e' && fn[2] == '\0')) { 0 0 0
(fn[0] == '-' && fn[1] == 'e' && fn[2] == '\0')) { 0 0 0
241  
242 0 AV *lines = get_file_src(aTHX_ fn);
243 0 ▶ if (lines) {
Branch: 1 branch
BranchTrueFalseTotal
if (lines) { 0 0 0
244 0 putmark(2);
245 0 putiv(aTHX_ file_id_generator);
246 0 putav(aTHX_ lines);
247 }
248 }
249 0 return file_id_generator;
250 }
251  
252 static IV
253 0 mapid(pTHX_ HV *fpidmap, IV pid, IV fid) {
254 static IV lfpid = 0;
255 static SV *key = 0;
256 SV **ent;
257 char *k;
258 STRLEN l;
259 0 ▶ if (!key) key = newSV(30);
Branch: 1 branch
BranchTrueFalseTotal
if (!key) key = newSV(30); 0 0 0
260 0 sv_setpvf(key, "%d:%d", pid, fid);
261 0 k = SvPV(key, l);
262 0 ent = hv_fetch(fpidmap, k, l, TRUE);
263 0 ▶ if (!SvOK(*ent))
Branch: 1 branch
BranchTrueFalseTotal
if (!SvOK(*ent)) 0 0 0
264 0 sv_setiv(*ent, ++lfpid);
265 0 return SvIV(*ent);
266 }
267  
268 static void
269 0 flock_and_header(pTHX) {
270 static IV lpid = 0;
271 0 IV pid = getpid();
272 0 ▶ if (pid != lpid && lpid) {
Branch: 2 branches
BranchTrueFalseTotal
if (pid != lpid && lpid) { 0 0 0
if (pid != lpid && lpid) { 0 0 0
273 0 out = fopen(outname, "ab");
274 0 ▶ if (!out)
Branch: 1 branch
BranchTrueFalseTotal
if (!out) 0 0 0
275 0 Perl_croak(aTHX_ "unable to reopen file %s", outname);
276  
277 0 flock(fileno(out), LOCK_EX);
278 0 fseek(out, 0, SEEK_END);
279  
280 0 putmark(5);
281 0 putiv(aTHX_ pid);
282  
283 0 putmark(6);
284 0 putiv(aTHX_ lpid);
285  
286 }
287 else {
288 0 flock(fileno(out), LOCK_EX);
289 0 fseek(out, 0, SEEK_END);
290  
291 0 putmark(5);
292 0 putiv(aTHX_ pid);
293 }
294 0 lpid = pid;
295 0 }
296  
297  
298 MODULE = Devel::FastProf PACKAGE = DB
299 PROTOTYPES: DISABLE
300  
301 void DB(...)
302 PPCODE:
303 {
304 IV ticks;
305 0 ▶ if (usecputime) {
Branch: 1 branch
BranchTrueFalseTotal
if (usecputime) { 0 0 0
306 struct tms buf;
307 0 times(&buf);
308 0 ticks = buf.tms_utime - old_tms.tms_utime + buf.tms_stime - old_tms.tms_stime;
309 }
310 else {
311 #if defined(HAS_GETTIMEOD)
312 struct timeval time;
313 0 gettimeofday(&time, NULL);
314 0 ▶ if (time.tv_sec < old_time.tv_sec + 2000) {
Branch: 1 branch
BranchTrueFalseTotal
if (time.tv_sec < old_time.tv_sec + 2000) { 0 0 0
315 0 ticks = (time.tv_sec - old_time.tv_sec) * 1000000 + time.tv_usec - old_time.tv_usec;
316 }
317 #else
318 UV time[2];
319 (*u2time)(aTHX_ time);
320 if (time[0] < old_time[0] + 2000) {
321 ticks = (time[0] - old_time[0]) * 1000000 + time[1] - old_time[1];
322 }
323 #endif
324 else {
325 0 ticks = 2000000000;
326 }
327 }
328 0 ▶ if (out) { /* out should never be NULL anyway */
Branch: 1 branch
BranchTrueFalseTotal
if (out) { /* out should never be NULL anyway */ 0 0 0
329 IV fid;
330 IV line;
331 char *file;
332 #if (PERL_VERSION < 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION < 8))
333 PERL_CONTEXT *cx = cxstack + cxstack_ix;
334 #endif
335 0 ▶ if (canfork)
Branch: 1 branch
BranchTrueFalseTotal
if (canfork) 0 0 0
336 0 flock_and_header(aTHX);
337 #if (PERL_VERSION < 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION < 8))
338 file = OutCopFILE(cx->blk_oldcop);
339 line = CopLINE(cx->blk_oldcop);
340 #else
341 0 ▶ file = OutCopFILE(PL_curcop);
Branch: 1 branch
BranchTrueFalseTotal
file = OutCopFILE(PL_curcop); 0 0 0
342 0 line = CopLINE(PL_curcop);
343 #endif
344 0 ▶ if (strcmp(file, old_fn)) {
Branch: 1 branch
BranchTrueFalseTotal
if (strcmp(file, old_fn)) { 0 0 0
345 0 fid = get_file_id(aTHX_ file);
346 0 putmark(7);
347 0 putiv(aTHX_ fid);
348 0 old_fn = file;
349 }
350 0 putiv(aTHX_ line);
351 0 ▶ if (ticks < 0) ticks = 0;
Branch: 1 branch
BranchTrueFalseTotal
if (ticks < 0) ticks = 0; 0 0 0
352 0 putiv(aTHX_ ticks);
353
354 0 ▶ if (canfork) {
Branch: 1 branch
BranchTrueFalseTotal
if (canfork) { 0 0 0
355 0 fflush(out);
356 0 flock(fileno(out), LOCK_UN);
357 }
358 }
359 0 ▶ if (usecputime) {
Branch: 1 branch
BranchTrueFalseTotal
if (usecputime) { 0 0 0
360 0 times(&old_tms);
361 }
362 else {
363 #if defined (HAS_GETTIMEOD)
364 0 gettimeofday(&old_time, NULL);
365 #else
366 (*u2time)(aTHX_ old_time);
367 #endif
368 }
369 }
370  
371 void _finish()
372 PPCODE:
373 {
374 0 ▶ if (out) {
Branch: 1 branch
BranchTrueFalseTotal
if (out) { 0 0 0
375 0 ▶ if (canfork) {
Branch: 1 branch
BranchTrueFalseTotal
if (canfork) { 0 0 0
376 0 flock_and_header(aTHX);
377 0 fflush(out);
378 0 flock(fileno(out), LOCK_UN);
379 }
380 0 fclose(out);
381 0 out = NULL;
382 }
383 }
384  
385  
386 void _init(char *_outname, int _usecputime, int _canfork)
387 PPCODE:
388 {
389 0 out = fopen(_outname, "wb");
390 0 ▶ if (!out) Perl_croak(aTHX_ "unable to open file %s for writing", _outname);
Branch: 1 branch
BranchTrueFalseTotal
if (!out) Perl_croak(aTHX_ "unable to open file %s for writing", _outname); 0 0 0
391 0 fwrite("D::FP-" XS_VERSION "\0\0\0\0\0\0\0", 1, 12, out);
392 0 putmark(3);
393 0 ▶ if (_usecputime) {
Branch: 1 branch
BranchTrueFalseTotal
if (_usecputime) { 0 0 0
394 0 usecputime = 1;
395 0 putiv(aTHX_ sysconf(_SC_CLK_TCK));
396 0 times(&old_tms);
397 }
398 else {
399 0 putiv(aTHX_ 1000000);
400 0 usecputime = 0;
401 #if defined (HAS_GETTIMEOD)
402 0 gettimeofday(&old_time, NULL);
403 #else
404 {
405 SV **svp = hv_fetch(PL_modglobal, "Time::U2time", 12, 0);
406 if (!svp || !SvIOK(*svp)) Perl_croak(aTHX_ "Time::HiRes is required");
407 u2time = INT2PTR(int(*)(pTHX_ UV*), SvIV(*svp));
408 }
409 (*u2time)(aTHX_ old_time);
410 #endif
411 }
412 0 ▶ if (_canfork) {
Branch: 1 branch
BranchTrueFalseTotal
if (_canfork) { 0 0 0
413 0 canfork = 1;
414 0 outname = strdup(_outname);
415 }
416 0 file_id_hv = get_hv("DB::file_id", TRUE);
417 }
418  
419  
420 MODULE = Devel::FastProf PACKAGE = Devel::FastProf::Reader
421  
422 void _read_file(char *infn)
423 PPCODE:
424 {
425 0 HV *ticks = get_hv("Devel::FastProf::Reader::TICKS", TRUE);
426 0 HV *count = get_hv("Devel::FastProf::Reader::COUNT", TRUE);
427 0 AV *fn = get_av("Devel::FastProf::Reader::FN", TRUE);
428 0 AV *src = get_av("Devel::FastProf::Reader::SRC", TRUE);
429 0 HV *fpidmap = get_hv("Devel::FastProf::Reader::FPIDMAP", TRUE);
430 0 HV *ppid = get_hv("Devel::FastProf::Reader::PPID", TRUE);
431 0 float inv_ticks_per_second = 1.0;
432 0 IV lfid = 0, nfid = 0, lline;
433 0 int not_first = 0;
434 0 IV pid = 0;
435 0 SV *key = sv_2mortal(newSV(30));
436 char *k;
437 STRLEN l;
438 SV **ent;
439 char head[12];
440 0 HV *pidlfid = (HV*)sv_2mortal((SV*)newHV());
441 0 HV *pidlline = (HV*)sv_2mortal((SV*)newHV());
442  
443 0 FILE *in = fopen(infn, "rb");
444 0 ▶ if (!in) Perl_croak(aTHX_ "unable to open %s for reading", infn);
Branch: 1 branch
BranchTrueFalseTotal
if (!in) Perl_croak(aTHX_ "unable to open %s for reading", infn); 0 0 0
445  
446 0 ▶ if ((fread(head, 1, 12, in) != 12) || strncmp(head, "D::FP-" XS_VERSION, 12))
Branch: 2 branches
BranchTrueFalseTotal
if ((fread(head, 1, 12, in) != 12) || strncmp(head, "D::FP-" XS_VERSION, 12)) 0 0 0
if ((fread(head, 1, 12, in) != 12) || strncmp(head, "D::FP-" XS_VERSION, 12)) 0 0 0
447 0 Perl_croak(aTHX_ "bad header, input file has not been generated by Devel::FastProf " XS_VERSION);
448  
449 0 ▶ while (fneof(in)) {
Branch: 1 branch
BranchTrueFalseTotal
while (fneof(in)) { 0 0 0
450 0 IV mark = fgetmark(aTHX_ in);
451 0 switch (mark) {
452 0 case 0: /* line execution timestamp */
453 {
454 0 IV line = fgetiv(aTHX_ in);
455 0 IV delta = fgetiv(aTHX_ in);
456 /* fprintf(stderr, "fid: %d, line: %d, delta: %d\n", fid, line, delta); */
457 0 ▶ if (not_first) {
Branch: 1 branch
BranchTrueFalseTotal
if (not_first) { 0 0 0
458 SV **tsv, **csv;
459 /* SV *key = newSVpvf("%d:%d", lfid, lline); */
460 0 sv_setpvf(key, "%d:%d", lfid, lline);
461 0 k = SvPV(key, l);
462 0 tsv = hv_fetch(ticks, k, l, TRUE);
463 0 csv = hv_fetch(count, k, l, TRUE);
464 0 ▶ if (tsv && csv) {
Branch: 2 branches
BranchTrueFalseTotal
if (tsv && csv) { 0 0 0
if (tsv && csv) { 0 0 0
465 0 ▶ float old = SvOK(*tsv) ? SvNV(*tsv) : 0.0;
Branch: 1 branch
BranchTrueFalseTotal
float old = SvOK(*tsv) ? SvNV(*tsv) : 0.0; 0 0 0
466 /* printf("delta: %d\n", delta); */
467 0 sv_setnv(*tsv, old + delta * inv_ticks_per_second);
468 0 sv_inc(*csv);
469 }
470 else {
471 0 Perl_croak(aTHX_ "internal error");
472 }
473 }
474 else {
475 0 not_first = 1;
476 }
477 0 lfid = nfid;
478 0 lline = line;
479 0 break;
480 }
481 0 case 1: /* filename comming */
482 {
483 0 ▶ IV fid = pid ? mapid(aTHX_ fpidmap, pid, fgetiv(aTHX_ in)) : fgetiv(aTHX_ in);
Branch: 1 branch
BranchTrueFalseTotal
IV fid = pid ? mapid(aTHX_ fpidmap, pid, fgetiv(aTHX_ in)) : fgetiv(aTHX_ in); 0 0 0
484 0 SV *fsv = fgetpv(aTHX_ in);
485 0 av_store(fn, fid, fsv);
486 0 break;
487 }
488 0 case 2: /* src comming */
489 {
490 0 ▶ IV fid = pid ? mapid(aTHX_ fpidmap, pid, fgetiv(aTHX_ in)) : fgetiv(aTHX_ in);
Branch: 1 branch
BranchTrueFalseTotal
IV fid = pid ? mapid(aTHX_ fpidmap, pid, fgetiv(aTHX_ in)) : fgetiv(aTHX_ in); 0 0 0
491 0 AV *lines = fgetav(aTHX_ in);
492 0 SV *ref = newRV_noinc((SV*)lines);
493 0 av_store(src, fid, ref);
494 0 break;
495 }
496 0 case 3: /* ticks per second */
497 {
498 0 IV tps = fgetiv(aTHX_ in);
499 0 ▶ if (!tps)
Branch: 1 branch
BranchTrueFalseTotal
if (!tps) 0 0 0
500 0 Perl_croak(aTHX_ "bad parameter value: ticks_per_second = 0");
501
502 0 inv_ticks_per_second = 1.0 / tps;
503 0 break;
504 }
505 0 case 4:
506 {
507 0 Perl_croak(aTHX_ "obsolete file format");
508 }
509 0 case 5:
510 {
511 0 ▶ if (not_first) {
Branch: 1 branch
BranchTrueFalseTotal
if (not_first) { 0 0 0
512 0 sv_setiv(key, pid);
513 0 k = SvPV(key, l);
514 0 ent = hv_fetch(pidlfid, k, l, TRUE);
515 0 sv_setiv(*ent, lfid);
516 0 ent = hv_fetch(pidlline, k, l, TRUE);
517 0 sv_setiv(*ent, lline);
518 }
519 0 pid = fgetiv(aTHX_ in);
520 0 sv_setiv(key, pid);
521 0 k = SvPV(key, l);
522 0 ent = hv_fetch(pidlfid, k, l, 0);
523 0 ▶ if (ent) {
Branch: 1 branch
BranchTrueFalseTotal
if (ent) { 0 0 0
524 0 not_first = 1;
525 0 lfid = SvIV(*ent);
526 0 ent = hv_fetch(pidlline, k, l, TRUE);
527 0 lline = SvIV(*ent);
528 }
529 else {
530 0 not_first = 0;
531 }
532 0 break;
533 }
534 0 case 6:
535 {
536 0 sv_setiv(key, pid);
537 0 k = SvPV(key, l);
538 0 ent = hv_fetch(ppid, k, l, TRUE);
539 0 sv_setiv(*ent, fgetiv(aTHX_ in));
540 0 break;
541 }
542 0 case 7:
543 {
544 0 IV fid = fgetiv(aTHX_ in);
545 0 ▶ nfid = pid ? mapid(aTHX_ fpidmap, pid, fid) : fid;
Branch: 1 branch
BranchTrueFalseTotal
nfid = pid ? mapid(aTHX_ fpidmap, pid, fid) : fid; 0 0 0
546 /* fprintf(stderr, "lfid: %d\n", nfid); fflush(stderr); */
547
548 0 break;
549 }
550 0 default:
551 0 Perl_croak(aTHX_ "bad file format");
552 }
553 }
554 }
« blib/lib/Devel/FastProf/Reader.pm ↑ Summary