Blob Blame History Raw
diff -up papi-4.2.1/src/components/lmsensors/linux-lmsensors.c.bz papi-4.2.1/src/components/lmsensors/linux-lmsensors.c
--- papi-4.2.1/src/components/lmsensors/linux-lmsensors.c.bz	2012-02-10 14:58:08.000000000 -0500
+++ papi-4.2.1/src/components/lmsensors/linux-lmsensors.c	2012-03-09 16:23:20.139608076 -0500
@@ -4,11 +4,11 @@
 #include "papi_memory.h"
 #include "linux-lmsensors.h"
 
+papi_vector_t _lmsensors_vector;
 
-
-/*******************************************************************************
- ********  BEGIN FUNCTIONS  USED INTERNALLY SPECIFIC TO THIS COMPONENT *********
- ******************************************************************************/
+/******************************************************************************
+ ********  BEGIN FUNCTIONS  USED INTERNALLY SPECIFIC TO THIS COMPONENT ********
+ *****************************************************************************/
 /*
  * Counts number of events available in this system
  */
@@ -50,72 +50,69 @@ createNativeEvents( void )
 	int chip_nr = 0;
 	const sensors_chip_name *chip_name;
 
-	cmp_id_t component;
-
 	/* component name and description */
-	strcpy( component.name, "LM_SENSORS" );
-	strcpy( component.descr,
-			"lm-sensors provides tools for monitoring the hardware health" );
+	strcpy( _lmsensors_vector.cmp_info.name, "LM_SENSORS" );
+	// strcpy( _lmsensors_vector.cmp_info.descr,
+	//		"lm-sensors provides tools for monitoring the hardware health" );
 
 
 	/* Loop through all the chips found */
 	while ( ( chip_name =
 			  sensors_get_detected_chips( NULL, &chip_nr ) ) != NULL ) {
-		int a, b;
-		const sensors_feature *feature;
-		const sensors_subfeature *sub;
-		char chipnamestring[PAPI_MIN_STR_LEN];
+	   int a, b;
+	   const sensors_feature *feature;
+	   const sensors_subfeature *sub;
+	   char chipnamestring[PAPI_MIN_STR_LEN];
 
-		lm_sensors_native_table[id].count = 0;
+	   //	   lm_sensors_native_table[id].count = 0;
 
 		/* get chip name from its internal representation */
-		sensors_snprintf_chip_name( chipnamestring,
-									PAPI_MIN_STR_LEN, chip_name );
+	   sensors_snprintf_chip_name( chipnamestring,
+					    PAPI_MIN_STR_LEN, chip_name );
 
-		a = 0;
-		/* Loop through all the features found */
-		while ( ( feature = sensors_get_features( chip_name, &a ) ) ) {
-			char *featurelabel;
+	   a = 0;
+
+	   /* Loop through all the features found */
+	   while ( ( feature = sensors_get_features( chip_name, &a ) ) ) {
+	      char *featurelabel;
 
-			if ( !( featurelabel = sensors_get_label( chip_name, feature ) ) ) {
-				fprintf( stderr, "ERROR: Can't get label of feature %s!\n",
+	      if ( !( featurelabel = sensors_get_label( chip_name, feature ))) {
+		 fprintf( stderr, "ERROR: Can't get label of feature %s!\n",
 						 feature->name );
-				continue;
-			}
+		 continue;
+	      }
 
-			b = 0;
+	      b = 0;
 
-			/* Loop through all the subfeatures found */
-			while ( ( sub =
-					  sensors_get_all_subfeatures( chip_name, feature,
-												   &b ) ) ) {
-				count = 0;
+	      /* Loop through all the subfeatures found */
+	      while ((sub=sensors_get_all_subfeatures(chip_name,feature,&b))) {
 
-				/* Save native event data */
-				sprintf( lm_sensors_native_table[id].name,
-						 "%s.%s.%s.%s",
-						 component.name,
-						 chipnamestring, featurelabel, sub->name );
+	         count = 0;
 
-				strncpy( lm_sensors_native_table[id].description,
-						 lm_sensors_native_table[id].name, PAPI_MAX_STR_LEN );
+		 /* Save native event data */
+		 sprintf( lm_sensors_native_table[id].name, "%s.%s.%s.%s",
+			  _lmsensors_vector.cmp_info.name,
+			  chipnamestring, featurelabel, sub->name );
 
-				/* The selector has to be !=0 . Starts with 1 */
-				lm_sensors_native_table[id].resources.selector = id + 1;
+		 strncpy( lm_sensors_native_table[id].description,
+			  lm_sensors_native_table[id].name, PAPI_MAX_STR_LEN );
 
-				/* Save the actual references to this event */
-				lm_sensors_native_table[id].resources.name = chip_name;
-				lm_sensors_native_table[id].resources.subfeat_nr = sub->number;
+		 /* The selector has to be !=0 . Starts with 1 */
+		 lm_sensors_native_table[id].resources.selector = id + 1;
 
-				count = sub->number;
+		 /* Save the actual references to this event */
+		 lm_sensors_native_table[id].resources.name = chip_name;
+		 lm_sensors_native_table[id].resources.subfeat_nr = sub->number;
 
-				/* increment the table index counter */
-				id++;
-			}
+		 count = sub->number;
 
-			lm_sensors_native_table[id].count = count + 1;
-			free( featurelabel );
-		}
+		 /* increment the table index counter */
+		 id++;		 
+	      }
+
+	      //   lm_sensors_native_table[id].count = count + 1;
+	      free( featurelabel );
+	   }
 	}
 
 	/* Return the number of events created */
@@ -179,6 +176,7 @@ LM_SENSORS_init_substrate(  )
 
 	/* Create dyanmic events table */
 	NUM_EVENTS = detectSensors(  );
+	//printf("Found %d sensors\n",NUM_EVENTS);
 
 	if ( ( lm_sensors_native_table =
 		   ( LM_SENSORS_native_event_entry_t * )
@@ -193,7 +191,7 @@ LM_SENSORS_init_substrate(  )
 		return EXIT_FAILURE;
 	}
 
-	return ( PAPI_OK );
+	return PAPI_OK;
 }
 
 
@@ -224,7 +222,8 @@ LM_SENSORS_start( hwd_context_t * ctx, h
 {
 	( void ) ctx;
 	( void ) ctrl;
-	return ( PAPI_OK );
+
+	return PAPI_OK;
 }
 
 
@@ -235,8 +234,9 @@ int
 LM_SENSORS_stop( hwd_context_t * ctx, hwd_control_state_t * ctrl )
 {
     ( void ) ctx;
-	( void ) ctrl;
-	return ( PAPI_OK );
+    ( void ) ctrl;
+
+    return PAPI_OK;
 }
 
 
@@ -444,9 +444,8 @@ LM_SENSORS_ntv_code_to_bits( unsigned in
 papi_vector_t _lmsensors_vector = {
 	.cmp_info = {
 				 /* default component information (unspecified values are initialized to 0) */
-				 .name =
-				 "$Id: linux-lmsensors.c,v 1.6 2012/02/10 19:58:08 terpstra Exp $",
-				 .version = "$Revision: 1.6 $",
+				 .name = "linux-lmsensors.c",
+				 .version = "4.2.1",
 				 .num_mpx_cntrs = PAPI_MPX_DEF_DEG,
 				 .num_cntrs = LM_SENSORS_MAX_COUNTERS,
 				 .default_domain = PAPI_DOM_USER,
@@ -489,5 +488,4 @@ papi_vector_t _lmsensors_vector = {
 	.ntv_enum_events = LM_SENSORS_ntv_enum_events,
 	.ntv_code_to_name = LM_SENSORS_ntv_code_to_name,
 	.ntv_code_to_bits = LM_SENSORS_ntv_code_to_bits,
-	.ntv_bits_to_info = NULL,
 };
diff -up papi-4.2.1/src/components/lmsensors/linux-lmsensors.h.bz papi-4.2.1/src/components/lmsensors/linux-lmsensors.h
--- papi-4.2.1/src/components/lmsensors/linux-lmsensors.h.bz	2012-02-09 10:02:53.000000000 -0500
+++ papi-4.2.1/src/components/lmsensors/linux-lmsensors.h	2012-03-09 15:57:31.393736053 -0500
@@ -4,7 +4,7 @@
 
 /** 
  * @file    linux-lmsensors.h
- * CVS:     $Id: linux-lmsensors.h,v 1.5 2012/02/09 15:02:53 jagode Exp $
+ * CVS:     $Id$
  * @author  Daniel Lucio
  * @author  Joachim Protze
  * @author  Heike Jagode