]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPICA: Add new statistics interface.
authorLv Zheng <lv.zheng@intel.com>
Thu, 31 Oct 2013 01:30:28 +0000 (09:30 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 31 Oct 2013 13:37:33 +0000 (14:37 +0100)
This patch ports new counters and statistics interface, already
implemented in ACPICA upstream, to Linux.  That helps to reduce
source code differences between Linux and ACPICA upstream.

[rjw: Changelog]
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/dsmethod.c
drivers/acpi/acpica/evsci.c
drivers/acpi/acpica/utglobal.c
drivers/acpi/acpica/utxface.c
include/acpi/acpixf.h
include/acpi/actypes.h

index 0fba431f4fcb90fd1bad8ec85b870486a33b70d6..e9f1fc7f99c708618bb95fda1c64175f34808fdc 100644 (file)
@@ -406,7 +406,9 @@ extern u32 acpi_gbl_nesting_level;
 
 /* Event counters */
 
+ACPI_EXTERN u32 acpi_method_count;
 ACPI_EXTERN u32 acpi_gpe_count;
+ACPI_EXTERN u32 acpi_sci_count;
 ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
 
 /* Support for dynamic control method tracing mechanism */
index df3ea125507f5959fa055ef44bc524fc9bdb02e0..81a78ba843112d335613fc55a2d0d2ae39e6bc3f 100644 (file)
@@ -292,6 +292,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
         * reentered one more time (even if it is the same thread)
         */
        obj_desc->method.thread_count++;
+       acpi_method_count++;
        return_ACPI_STATUS(status);
 
 cleanup:
index 94d9ebddf5755031a34b654664b0be6471330662..9e9e3454d8932c9c44f853bbe3d05edffeb38130 100644 (file)
@@ -137,6 +137,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
 
        interrupt_handled |= acpi_ev_sci_dispatch();
 
+       acpi_sci_count++;
        return_UINT32(interrupt_handled);
 }
 
index 77caa4fbcdeee1df45ccd62f08adcc59cc877f0d..81f9a958445189b84cad67f491fb5b5c466a9559 100644 (file)
@@ -289,6 +289,16 @@ acpi_status acpi_ut_init_globals(void)
 
        acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
 
+       /* Event counters */
+
+       acpi_method_count = 0;
+       acpi_sci_count = 0;
+       acpi_gpe_count = 0;
+
+       for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
+               acpi_fixed_event_count[i] = 0;
+       }
+
 #if (!ACPI_REDUCED_HARDWARE)
 
        /* GPE/SCI support */
@@ -383,4 +393,6 @@ ACPI_EXPORT_SYMBOL(acpi_dbg_level)
 
 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
 
+ACPI_EXPORT_SYMBOL(acpi_gpe_count)
+
 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)
index 891a37b69d3ceae29ad74c99f547d313a8bd261e..39869022a417e7bfd31454e930de7a91ff87ac74 100644 (file)
@@ -208,6 +208,44 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
 
 ACPI_EXPORT_SYMBOL(acpi_get_system_info)
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_get_statistics
+ *
+ * PARAMETERS:  stats           - Where the statistics are returned
+ *
+ * RETURN:      status          - the status of the call
+ *
+ * DESCRIPTION: Get the contents of the various system counters
+ *
+ ******************************************************************************/
+acpi_status acpi_get_statistics(struct acpi_statistics *stats)
+{
+       ACPI_FUNCTION_TRACE(acpi_get_statistics);
+
+       /* Parameter validation */
+
+       if (!stats) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       /* Various interrupt-based event counters */
+
+       stats->sci_count = acpi_sci_count;
+       stats->gpe_count = acpi_gpe_count;
+
+       ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count,
+                   sizeof(acpi_fixed_event_count));
+
+       /* Other counters */
+
+       stats->method_count = acpi_method_count;
+
+       return_ACPI_STATUS(AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_get_statistics)
+
 /*****************************************************************************
  *
  * FUNCTION:    acpi_install_initialization_handler
index b2dcab0438c6379f1d398bb7f519baa9390cf740..7def8cabfaba43431b287443def61f48bdeac60a 100644 (file)
@@ -140,6 +140,8 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
 acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
 #endif
 
+acpi_status acpi_get_statistics(struct acpi_statistics *stats);
+
 const char *acpi_format_exception(acpi_status exception);
 
 acpi_status acpi_purge_cached_objects(void);
index 8614bc1391137e3fab0c4f0d62e58716ca5ed0b0..0e32b6cab6e69f18483182b2f501a0aa3aa57013 100644 (file)
@@ -973,6 +973,16 @@ struct acpi_system_info {
        u32 debug_layer;
 };
 
+/*
+ * System statistics returned by acpi_get_statistics()
+ */
+struct acpi_statistics {
+       u32 sci_count;
+       u32 gpe_count;
+       u32 fixed_event_count[ACPI_NUM_FIXED_EVENTS];
+       u32 method_count;
+};
+
 /* Table Event Types */
 
 #define ACPI_TABLE_EVENT_LOAD           0x0