Lines Matching defs:pgf

121 pmcstat_gmon_create_file(struct pmcstat_gmonfile *pgf,
130 pathname = pmcstat_string_unintern(pgf->pgf_name);
137 gm.ncnt = (pgf->pgf_nbuckets * hc_sz) + sizeof(struct gmonhdr);
153 count = pgf->pgf_ndatabytes - sizeof(struct gmonhdr);
200 pmcstat_gmon_map_file(struct pmcstat_gmonfile *pgf)
205 pathname = pmcstat_string_unintern(pgf->pgf_name);
211 pgf->pgf_gmondata = mmap(NULL, pgf->pgf_ndatabytes,
214 if (pgf->pgf_gmondata == MAP_FAILED)
225 pmcstat_gmon_unmap_file(struct pmcstat_gmonfile *pgf)
227 (void) msync(pgf->pgf_gmondata, pgf->pgf_ndatabytes,
229 (void) munmap(pgf->pgf_gmondata, pgf->pgf_ndatabytes);
230 pgf->pgf_gmondata = NULL;
239 struct pmcstat_gmonfile *pgf;
241 if ((pgf = pmcstat_image_find_gmonfile(image, pmcid)) == NULL)
244 if (pgf->pgf_file == NULL) {
245 pathname = pmcstat_string_unintern(pgf->pgf_name);
246 if ((pgf->pgf_file = fopen(pathname, "a")) == NULL)
254 (void) fwrite(&arc, sizeof(arc), 1, pgf->pgf_file);
261 struct pmcstat_gmonfile *pgf;
262 LIST_FOREACH(pgf, &image->pi_gmlist, pgf_next)
263 if (pgf->pgf_pmcid == pmcid)
264 return (pgf);
369 struct pmcstat_gmonfile *pgf, *pgftmp;
371 LIST_FOREACH_SAFE(pgf, &pi->pi_gmlist, pgf_next, pgftmp) {
372 if (pgf->pgf_file)
373 (void) fclose(pgf->pgf_file);
374 LIST_REMOVE(pgf, pgf_next);
375 free(pgf);
414 struct pmcstat_gmonfile *pgf;
453 pgf = pmcstat_image_find_gmonfile(image, pmcid);
454 if (pgf == NULL) {
463 if ((pgf = calloc(1, sizeof(*pgf))) == NULL)
466 pgf->pgf_gmondata = NULL; /* mark as unmapped */
467 pgf->pgf_name = pmcstat_gmon_create_name(args.pa_samplesdir,
469 pgf->pgf_pmcid = pmcid;
471 pgf->pgf_nbuckets = (image->pi_end - image->pi_start) /
473 pgf->pgf_ndatabytes = sizeof(struct gmonhdr) +
474 pgf->pgf_nbuckets * hc_sz;
475 pgf->pgf_nsamples = 0;
476 pgf->pgf_file = NULL;
478 pmcstat_gmon_create_file(pgf, image);
480 LIST_INSERT_HEAD(&image->pi_gmlist, pgf, pgf_next);
487 if (pgf->pgf_gmondata == NULL)
488 pmcstat_gmon_map_file(pgf);
490 assert(pgf->pgf_gmondata != NULL);
498 assert(bucket < pgf->pgf_nbuckets);
501 whc = (WIDEHISTCOUNTER *) ((uintptr_t) pgf->pgf_gmondata +
508 pgf->pgf_overflow = 1;
510 hc = (HISTCOUNTER *) ((uintptr_t) pgf->pgf_gmondata +
517 pgf->pgf_overflow = 1;
520 pgf->pgf_nsamples++;
531 struct pmcstat_gmonfile *pgf;
546 LIST_FOREACH(pgf, &pi->pi_gmlist, pgf_next) {
547 pmcstat_gmon_unmap_file(pgf);
551 pgf->pgf_pmcid),
552 pgf->pgf_nsamples);
553 if (pgf->pgf_overflow && args.pa_verbosity >= 1)
557 pgf->pgf_name));