summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2005-07-09 17:08:46 +0000
committerjkoshy <jkoshy@FreeBSD.org>2005-07-09 17:08:46 +0000
commit93ae007c34b5a61e3d494d72d4a7e8378390d83d (patch)
tree89674c04bd81aae33f8006f2511fdac652e98d48 /usr.sbin/pmcstat
parenta62ddd3522853d6c4c5cc44450d5f53420110dad (diff)
downloadFreeBSD-src-93ae007c34b5a61e3d494d72d4a7e8378390d83d.zip
FreeBSD-src-93ae007c34b5a61e3d494d72d4a7e8378390d83d.tar.gz
Fix a bug that affected on-the-fly gmon.out file generation.
Approved by: re (scottl)
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r--usr.sbin/pmcstat/pmcstat.c11
-rw-r--r--usr.sbin/pmcstat/pmcstat.h2
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c8
3 files changed, 9 insertions, 12 deletions
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
index c32b55f..c41fa77 100644
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -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:
diff --git a/usr.sbin/pmcstat/pmcstat.h b/usr.sbin/pmcstat/pmcstat.h
index 393e3fa..f0246f9 100644
--- a/usr.sbin/pmcstat/pmcstat.h
+++ b/usr.sbin/pmcstat/pmcstat.h
@@ -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);
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index 111064d..500959d 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -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
OpenPOWER on IntegriCloud