Fix a bug that affected on-the-fly gmon.out file generation.

Approved by:	re (scottl)
This commit is contained in:
jkoshy 2005-07-09 17:08:46 +00:00
parent a62ddd3522
commit 93ae007c34
3 changed files with 9 additions and 12 deletions

View File

@ -88,10 +88,6 @@ pmcstat_cleanup(struct pmcstat_args *a)
{
struct pmcstat_ev *ev, *tmp;
/* de-configure the log file if present. */
if (a->pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE))
(void) pmc_configure_logfile(-1);
/* release allocated PMCs. */
STAILQ_FOREACH_SAFE(ev, &a->pa_head, ev_next, tmp)
if (ev->ev_pmcid != PMC_ID_INVALID) {
@ -104,6 +100,10 @@ pmcstat_cleanup(struct pmcstat_args *a)
free(ev);
}
/* de-configure the log file if present. */
if (a->pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE))
(void) pmc_configure_logfile(-1);
if (a->pa_logparser) {
pmclog_close(a->pa_logparser);
a->pa_logparser = NULL;
@ -306,7 +306,6 @@ pmcstat_start_process(struct pmcstat_args *a)
(void) close(pmcstat_pipefd[WRITEPIPEFD]);
}
void
pmcstat_show_usage(void)
{
@ -884,7 +883,7 @@ main(int argc, char **argv)
break;
case EVFILT_READ: /* log file data is present */
runstate = pmcstat_print_log(&args);
runstate = pmcstat_process_log(&args);
break;
case EVFILT_SIGNAL:

View File

@ -120,7 +120,7 @@ void pmcstat_show_usage(void);
void pmcstat_shutdown_logging(void);
void pmcstat_start_pmcs(struct pmcstat_args *_a);
void pmcstat_start_process(struct pmcstat_args *_a);
void pmcstat_process_log(struct pmcstat_args *_a);
int pmcstat_process_log(struct pmcstat_args *_a);
int pmcstat_print_log(struct pmcstat_args *_a);
int pmcstat_convert_log(struct pmcstat_args *_a);

View File

@ -1159,7 +1159,7 @@ pmcstat_print_log(struct pmcstat_args *a)
* Process a log file in offline analysis mode.
*/
void
int
pmcstat_process_log(struct pmcstat_args *a)
{
@ -1168,12 +1168,10 @@ pmcstat_process_log(struct pmcstat_args *a)
* log to the current output file.
*/
if (a->pa_flags & FLAG_DO_PRINT)
pmcstat_print_log(a);
return pmcstat_print_log(a);
else
/* convert the log to gprof compatible profiles */
pmcstat_convert_log(a);
return;
return pmcstat_convert_log(a);
}
void