Print this page
10146 core_pcbe_event_coverage() is missing an else
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Gergő Doma <domag02@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>


   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) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2018 Joyent, Inc.
  24  */
  25 
  26 /*
  27  * This file contains preset event names from the Performance Application
  28  * Programming Interface v3.5 which included the following notice:
  29  *
  30  *                             Copyright (c) 2005,6
  31  *                           Innovative Computing Labs
  32  *                         Computer Science Department,
  33  *                            University of Tennessee,
  34  *                                 Knoxville, TN.
  35  *                              All Rights Reserved.
  36  *
  37  *
  38  * Redistribution and use in source and binary forms, with or without
  39  * modification, are permitted provided that the following conditions are met:
  40  *
  41  *    * Redistributions of source code must retain the above copyright notice,
  42  *      this list of conditions and the following disclaimer.
  43  *    * Redistributions in binary form must reproduce the above copyright


 976 static uint64_t
 977 core_pcbe_event_coverage(char *event)
 978 {
 979         uint64_t bitmap;
 980         uint64_t bitmask;
 981         const struct events_table_t *n;
 982         int i;
 983 
 984         bitmap = 0;
 985 
 986         /* Is it an event that a GPC can track? */
 987         if (versionid >= 3) {
 988                 n = find_gpcevent(event);
 989                 if (n != NULL) {
 990                         bitmap |= (n->supported_counters &
 991                             BITMASK_XBITS(num_gpc));
 992                 }
 993         } else {
 994                 if (find_generic_events(event, cmn_generic_events) != NULL) {
 995                         bitmap |= BITMASK_XBITS(num_gpc);
 996                 } if (find_generic_events(event, generic_events_pic0) != NULL) {

 997                         bitmap |= 1ULL;
 998                 } else if (find_gpcevent_core_uarch(event,
 999                     cmn_gpc_events_core_uarch) != NULL) {
1000                         bitmap |= BITMASK_XBITS(num_gpc);
1001                 } else if (find_gpcevent_core_uarch(event, pic0_events) !=
1002                     NULL) {
1003                         bitmap |= 1ULL;
1004                 } else if (find_gpcevent_core_uarch(event, pic1_events) !=
1005                     NULL) {
1006                         bitmap |= 1ULL << 1;
1007                 }
1008         }
1009 
1010         /* Check if the event can be counted in the fixed-function counters */
1011         if (num_ffc > 0) {
1012                 bitmask = 1ULL << num_gpc;
1013                 for (i = 0; i < num_ffc; i++) {
1014                         if (strcmp(event, ffc_names[i]) == 0) {
1015                                 bitmap |= bitmask;
1016                         } else if (strcmp(event, ffc_genericnames[i]) == 0) {




   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) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2019 Joyent, Inc.
  24  */
  25 
  26 /*
  27  * This file contains preset event names from the Performance Application
  28  * Programming Interface v3.5 which included the following notice:
  29  *
  30  *                             Copyright (c) 2005,6
  31  *                           Innovative Computing Labs
  32  *                         Computer Science Department,
  33  *                            University of Tennessee,
  34  *                                 Knoxville, TN.
  35  *                              All Rights Reserved.
  36  *
  37  *
  38  * Redistribution and use in source and binary forms, with or without
  39  * modification, are permitted provided that the following conditions are met:
  40  *
  41  *    * Redistributions of source code must retain the above copyright notice,
  42  *      this list of conditions and the following disclaimer.
  43  *    * Redistributions in binary form must reproduce the above copyright


 976 static uint64_t
 977 core_pcbe_event_coverage(char *event)
 978 {
 979         uint64_t bitmap;
 980         uint64_t bitmask;
 981         const struct events_table_t *n;
 982         int i;
 983 
 984         bitmap = 0;
 985 
 986         /* Is it an event that a GPC can track? */
 987         if (versionid >= 3) {
 988                 n = find_gpcevent(event);
 989                 if (n != NULL) {
 990                         bitmap |= (n->supported_counters &
 991                             BITMASK_XBITS(num_gpc));
 992                 }
 993         } else {
 994                 if (find_generic_events(event, cmn_generic_events) != NULL) {
 995                         bitmap |= BITMASK_XBITS(num_gpc);
 996                 } else if (find_generic_events(event,
 997                     generic_events_pic0) != NULL) {
 998                         bitmap |= 1ULL;
 999                 } else if (find_gpcevent_core_uarch(event,
1000                     cmn_gpc_events_core_uarch) != NULL) {
1001                         bitmap |= BITMASK_XBITS(num_gpc);
1002                 } else if (find_gpcevent_core_uarch(event, pic0_events) !=
1003                     NULL) {
1004                         bitmap |= 1ULL;
1005                 } else if (find_gpcevent_core_uarch(event, pic1_events) !=
1006                     NULL) {
1007                         bitmap |= 1ULL << 1;
1008                 }
1009         }
1010 
1011         /* Check if the event can be counted in the fixed-function counters */
1012         if (num_ffc > 0) {
1013                 bitmask = 1ULL << num_gpc;
1014                 for (i = 0; i < num_ffc; i++) {
1015                         if (strcmp(event, ffc_names[i]) == 0) {
1016                                 bitmap |= bitmask;
1017                         } else if (strcmp(event, ffc_genericnames[i]) == 0) {