Print this page
3379 Typo or undefined operation in uts/common/cpr/cpr_stat.c


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*

  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 #include <sys/types.h>
  29 #include <sys/ddi.h>
  30 #include <sys/pte.h>
  31 #include <sys/cpr.h>
  32 
  33 /*
  34  * Support routines for CPR statistic collection
  35  */
  36 struct cpr_event cpr_events_buf[CPR_E_MAX_EVENTNUM];
  37 
  38 extern struct cpr_terminator cpr_term;
  39 
  40 struct cpr_event *cpr_find_event(char *name, int new);
  41 
  42 #define CPR_DEFAULT_PROMTIME            30
  43 #define CE_START_MASK                   0x8000000
  44 
  45 /*
  46  * Use ctp to specify another time point instead of the current time;
  47  * Otherwise, ctp is NULL.


  54 
  55         if (ctp)
  56                 tv = *ctp;
  57         else {
  58                 /* need relative time even when hrestime is stoped */
  59                 cpr_tod_get(&tv);
  60         }
  61 
  62         if ((cep = cpr_find_event(name, 1)) == NULL) {
  63                 cpr_err(CE_WARN, "cpr_stat: run out of event buffers");
  64                 return;
  65         }
  66         /*
  67          * disallow entering start twice without calling end first
  68          */
  69         if (cep->ce_ntests & CE_START_MASK)
  70                 return;
  71 
  72         cep->ce_ntests |= CE_START_MASK;
  73         cep->ce_sec.stime = cep->ce_sec.etime = tv.tv_sec;
  74         cep->ce_sec.ltime = cep->ce_sec.ltime = 0;
  75         cep->ce_msec.stime = cep->ce_msec.etime = tv.tv_nsec / 100000000;
  76         cep->ce_msec.ltime = cep->ce_msec.ltime = 0;
  77 }
  78 
  79 void
  80 cpr_stat_event_end(char *name, cpr_time_t *ctp)
  81 {
  82         struct cpr_stat *cp = STAT;
  83         struct cpr_event *cep;
  84         cpr_time_t tv;
  85 
  86         if (ctp)
  87                 tv = *ctp;
  88         else
  89                 cpr_tod_get(&tv);
  90 
  91         if ((cep = cpr_find_event(name, 0)) == NULL) {
  92 #ifdef CPR_STAT
  93                 prom_printf("cpr_stat: event \"%s\" is not monitored\n", name);
  94 #endif /* CPR_STAT */
  95                 return;
  96         }




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2014 Gary Mills
  23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 


  27 #include <sys/types.h>
  28 #include <sys/ddi.h>
  29 #include <sys/pte.h>
  30 #include <sys/cpr.h>
  31 
  32 /*
  33  * Support routines for CPR statistic collection
  34  */
  35 struct cpr_event cpr_events_buf[CPR_E_MAX_EVENTNUM];
  36 
  37 extern struct cpr_terminator cpr_term;
  38 
  39 struct cpr_event *cpr_find_event(char *name, int new);
  40 
  41 #define CPR_DEFAULT_PROMTIME            30
  42 #define CE_START_MASK                   0x8000000
  43 
  44 /*
  45  * Use ctp to specify another time point instead of the current time;
  46  * Otherwise, ctp is NULL.


  53 
  54         if (ctp)
  55                 tv = *ctp;
  56         else {
  57                 /* need relative time even when hrestime is stoped */
  58                 cpr_tod_get(&tv);
  59         }
  60 
  61         if ((cep = cpr_find_event(name, 1)) == NULL) {
  62                 cpr_err(CE_WARN, "cpr_stat: run out of event buffers");
  63                 return;
  64         }
  65         /*
  66          * disallow entering start twice without calling end first
  67          */
  68         if (cep->ce_ntests & CE_START_MASK)
  69                 return;
  70 
  71         cep->ce_ntests |= CE_START_MASK;
  72         cep->ce_sec.stime = cep->ce_sec.etime = tv.tv_sec;
  73         cep->ce_sec.ltime = 0;
  74         cep->ce_msec.stime = cep->ce_msec.etime = tv.tv_nsec / 100000000;
  75         cep->ce_msec.ltime = 0;
  76 }
  77 
  78 void
  79 cpr_stat_event_end(char *name, cpr_time_t *ctp)
  80 {
  81         struct cpr_stat *cp = STAT;
  82         struct cpr_event *cep;
  83         cpr_time_t tv;
  84 
  85         if (ctp)
  86                 tv = *ctp;
  87         else
  88                 cpr_tod_get(&tv);
  89 
  90         if ((cep = cpr_find_event(name, 0)) == NULL) {
  91 #ifdef CPR_STAT
  92                 prom_printf("cpr_stat: event \"%s\" is not monitored\n", name);
  93 #endif /* CPR_STAT */
  94                 return;
  95         }