Commit 9187a415fd119c1d89a5ad2fd05513cd43699ebf

Authored by Lv Zheng
Committed by Rafael J. Wysocki
1 parent fa5f508f94

ACPICA: Add new statistics interface.

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>

Showing 7 changed files with 66 additions and 0 deletions Side-by-side Diff

drivers/acpi/acpica/acglobal.h
... ... @@ -406,7 +406,9 @@
406 406  
407 407 /* Event counters */
408 408  
  409 +ACPI_EXTERN u32 acpi_method_count;
409 410 ACPI_EXTERN u32 acpi_gpe_count;
  411 +ACPI_EXTERN u32 acpi_sci_count;
410 412 ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
411 413  
412 414 /* Support for dynamic control method tracing mechanism */
drivers/acpi/acpica/dsmethod.c
... ... @@ -292,6 +292,7 @@
292 292 * reentered one more time (even if it is the same thread)
293 293 */
294 294 obj_desc->method.thread_count++;
  295 + acpi_method_count++;
295 296 return_ACPI_STATUS(status);
296 297  
297 298 cleanup:
drivers/acpi/acpica/evsci.c
... ... @@ -137,6 +137,7 @@
137 137  
138 138 interrupt_handled |= acpi_ev_sci_dispatch();
139 139  
  140 + acpi_sci_count++;
140 141 return_UINT32(interrupt_handled);
141 142 }
142 143  
drivers/acpi/acpica/utglobal.c
... ... @@ -289,6 +289,16 @@
289 289  
290 290 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
291 291  
  292 + /* Event counters */
  293 +
  294 + acpi_method_count = 0;
  295 + acpi_sci_count = 0;
  296 + acpi_gpe_count = 0;
  297 +
  298 + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
  299 + acpi_fixed_event_count[i] = 0;
  300 + }
  301 +
292 302 #if (!ACPI_REDUCED_HARDWARE)
293 303  
294 304 /* GPE/SCI support */
... ... @@ -382,6 +392,8 @@
382 392 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
383 393  
384 394 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
  395 +
  396 +ACPI_EXPORT_SYMBOL(acpi_gpe_count)
385 397  
386 398 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)
drivers/acpi/acpica/utxface.c
... ... @@ -208,6 +208,44 @@
208 208  
209 209 ACPI_EXPORT_SYMBOL(acpi_get_system_info)
210 210  
  211 +/*******************************************************************************
  212 + *
  213 + * FUNCTION: acpi_get_statistics
  214 + *
  215 + * PARAMETERS: stats - Where the statistics are returned
  216 + *
  217 + * RETURN: status - the status of the call
  218 + *
  219 + * DESCRIPTION: Get the contents of the various system counters
  220 + *
  221 + ******************************************************************************/
  222 +acpi_status acpi_get_statistics(struct acpi_statistics *stats)
  223 +{
  224 + ACPI_FUNCTION_TRACE(acpi_get_statistics);
  225 +
  226 + /* Parameter validation */
  227 +
  228 + if (!stats) {
  229 + return_ACPI_STATUS(AE_BAD_PARAMETER);
  230 + }
  231 +
  232 + /* Various interrupt-based event counters */
  233 +
  234 + stats->sci_count = acpi_sci_count;
  235 + stats->gpe_count = acpi_gpe_count;
  236 +
  237 + ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count,
  238 + sizeof(acpi_fixed_event_count));
  239 +
  240 + /* Other counters */
  241 +
  242 + stats->method_count = acpi_method_count;
  243 +
  244 + return_ACPI_STATUS(AE_OK);
  245 +}
  246 +
  247 +ACPI_EXPORT_SYMBOL(acpi_get_statistics)
  248 +
211 249 /*****************************************************************************
212 250 *
213 251 * FUNCTION: acpi_install_initialization_handler
include/acpi/acpixf.h
... ... @@ -140,6 +140,8 @@
140 140 acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
141 141 #endif
142 142  
  143 +acpi_status acpi_get_statistics(struct acpi_statistics *stats);
  144 +
143 145 const char *acpi_format_exception(acpi_status exception);
144 146  
145 147 acpi_status acpi_purge_cached_objects(void);
include/acpi/actypes.h
... ... @@ -973,6 +973,16 @@
973 973 u32 debug_layer;
974 974 };
975 975  
  976 +/*
  977 + * System statistics returned by acpi_get_statistics()
  978 + */
  979 +struct acpi_statistics {
  980 + u32 sci_count;
  981 + u32 gpe_count;
  982 + u32 fixed_event_count[ACPI_NUM_FIXED_EVENTS];
  983 + u32 method_count;
  984 +};
  985 +
976 986 /* Table Event Types */
977 987  
978 988 #define ACPI_TABLE_EVENT_LOAD 0x0