| 1 | /********************************************************************** |
|---|
| 2 | * Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others. |
|---|
| 3 | * All rights reserved. This program and the accompanying materials |
|---|
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 5 | * which accompanies this distribution, and is available at |
|---|
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
|---|
| 7 | * |
|---|
| 8 | * Contributors: |
|---|
| 9 | * David Carter - Initial API and implementation |
|---|
| 10 | **********************************************************************/ |
|---|
| 11 | |
|---|
| 12 | #ifndef LIBARM4_SHM_H |
|---|
| 13 | #define LIBARM4_SHM_H 1 |
|---|
| 14 | |
|---|
| 15 | #include "arm4_shm.h" |
|---|
| 16 | |
|---|
| 17 | int __libarm4_shm_get_instance (void); |
|---|
| 18 | |
|---|
| 19 | arm4_shm_header_t *__libarm4_shm_get_header (void); |
|---|
| 20 | arm_boolean_t __libarm4_shm_is_collecting (void); |
|---|
| 21 | |
|---|
| 22 | /* Tree mutexes. These always use pthreads, since they're local to the process */ |
|---|
| 23 | struct tree; /* Forward declaration */ |
|---|
| 24 | void __libarm4_shm_init_tree (struct tree *tree_ptr); |
|---|
| 25 | void __libarm4_shm_lock_tree (struct tree *tree_ptr); |
|---|
| 26 | void __libarm4_shm_unlock_tree (struct tree *tree_ptr); |
|---|
| 27 | |
|---|
| 28 | /* Mutex routines */ |
|---|
| 29 | void __libarm4_shm_lock_sequence (void); |
|---|
| 30 | void __libarm4_shm_unlock_sequence (void); |
|---|
| 31 | void __libarm4_shm_lock_application (void); |
|---|
| 32 | void __libarm4_shm_unlock_application (void); |
|---|
| 33 | void __libarm4_shm_lock_transaction (void); |
|---|
| 34 | void __libarm4_shm_unlock_transaction (void); |
|---|
| 35 | void __libarm4_shm_lock_metric (void); |
|---|
| 36 | void __libarm4_shm_unlock_metric (void); |
|---|
| 37 | |
|---|
| 38 | /* Utility functions */ |
|---|
| 39 | int __libarm4_shm_is_valid_identifier (const arm_char_t *name_ptr); |
|---|
| 40 | |
|---|
| 41 | /* Application instance queue */ |
|---|
| 42 | void __libarm4_shm_add_app_instance (arm_app_start_handle_t app_handle, |
|---|
| 43 | arm_id_t appl_id, |
|---|
| 44 | arm_boolean_t active); |
|---|
| 45 | void __libarm4_shm_add_app_group (arm_app_start_handle_t app_handle, |
|---|
| 46 | const char *group_name); |
|---|
| 47 | void __libarm4_shm_add_app_instance_id (arm_app_start_handle_t app_handle, |
|---|
| 48 | const char *id_ptr); |
|---|
| 49 | void __libarm4_shm_add_app_context (arm_app_start_handle_t app_handle, |
|---|
| 50 | int index, |
|---|
| 51 | const char *context_ptr); |
|---|
| 52 | void __libarm4_shm_add_app_address (arm_app_start_handle_t app_handle, |
|---|
| 53 | const arm_subbuffer_system_address_t *address_buffer); |
|---|
| 54 | |
|---|
| 55 | /* Transaction instance queue */ |
|---|
| 56 | int __libarm4_shm_transaction_trace (const arm_id_t tran_id, const arm_int32_t flags, const arm_boolean_t force_trace); |
|---|
| 57 | int __libarm4_shm_try_tran_instance (arm_tran_start_handle_t tran_handle, |
|---|
| 58 | arm_id_t appl_id, |
|---|
| 59 | arm_id_t tran_id, |
|---|
| 60 | arm_app_start_handle_t app_handle, |
|---|
| 61 | arm_time_t arrival_time, |
|---|
| 62 | arm_time_t stop_time, |
|---|
| 63 | arm_time_t response_time, |
|---|
| 64 | arm_time_t blocked_time, |
|---|
| 65 | arm_tran_status_t tran_status, |
|---|
| 66 | arm_boolean_t active); |
|---|
| 67 | void __libarm4_shm_add_tran_instance (arm_tran_start_handle_t tran_handle, |
|---|
| 68 | arm_id_t appl_id, |
|---|
| 69 | arm_id_t tran_id, |
|---|
| 70 | arm_app_start_handle_t app_handle, |
|---|
| 71 | arm_time_t arrival_time, |
|---|
| 72 | arm_time_t stop_time, |
|---|
| 73 | arm_time_t response_time, |
|---|
| 74 | arm_time_t blocked_time, |
|---|
| 75 | arm_tran_status_t tran_status, |
|---|
| 76 | arm_boolean_t active); |
|---|
| 77 | void __libarm4_shm_add_tran_context (arm_tran_start_handle_t tran_handle, |
|---|
| 78 | int index, |
|---|
| 79 | const char *context_ptr); |
|---|
| 80 | void __libarm4_shm_add_tran_uri (arm_tran_start_handle_t tran_handle, |
|---|
| 81 | const char *uri_ptr); |
|---|
| 82 | void __libarm4_shm_add_metric_value (arm_tran_start_handle_t tran_handle, |
|---|
| 83 | const arm_metric_t *metric_ptr); |
|---|
| 84 | void __libarm4_shm_add_user (arm_tran_start_handle_t tran_handle, |
|---|
| 85 | const arm_subbuffer_user_t *user_ptr); |
|---|
| 86 | void __libarm4_shm_add_diag (arm_tran_start_handle_t tran_handle, |
|---|
| 87 | const arm_subbuffer_diag_detail_t *diag_ptr); |
|---|
| 88 | |
|---|
| 89 | /* Correlator queue */ |
|---|
| 90 | void __libarm4_shm_add_correlators (arm_tran_start_handle_t tran_handle, |
|---|
| 91 | const arm_correlator_t *parent_correlator, |
|---|
| 92 | const arm_correlator_t *current_correlator); |
|---|
| 93 | |
|---|
| 94 | /* Sequences */ |
|---|
| 95 | void __libarm4_shm_save_sequence (arm4_shm_sequence_t index, |
|---|
| 96 | arm_int64_t sequence); |
|---|
| 97 | int __libarm4_shm_next_sequence_number (arm4_shm_sequence_t index, |
|---|
| 98 | arm_int64_t *sequence_ptr); |
|---|
| 99 | |
|---|
| 100 | /* Return requests */ |
|---|
| 101 | void __libarm4_shm_return_request (void); |
|---|
| 102 | int __libarm4_shm_get_return (arm_int64_t *value_ptr); |
|---|
| 103 | |
|---|
| 104 | /* Register application */ |
|---|
| 105 | void __libarm4_shm_register_application (const unsigned char *digest_ptr, |
|---|
| 106 | const arm_char_t *app_name_ptr, |
|---|
| 107 | arm_charset_t charset, |
|---|
| 108 | int application_index); |
|---|
| 109 | arm_error_t __libarm4_shm_register_application_identity (const arm_id_t *app_id_ptr, |
|---|
| 110 | const arm_subbuffer_app_identity_t *identity_buffer_ptr); |
|---|
| 111 | |
|---|
| 112 | /* Register transaction */ |
|---|
| 113 | void __libarm4_shm_register_transaction (const unsigned char *digest, |
|---|
| 114 | const arm_id_t *app_id_ptr, |
|---|
| 115 | const arm_char_t *tran_name, |
|---|
| 116 | int transaction_index); |
|---|
| 117 | arm_error_t __libarm4_shm_register_transaction_identity (const arm_id_t *tran_id_ptr, |
|---|
| 118 | const arm_subbuffer_tran_identity_t *identity_buffer_ptr); |
|---|
| 119 | arm_error_t __libarm4_shm_register_transaction_metric_binding (const arm_id_t *tran_id_ptr, |
|---|
| 120 | const arm_subbuffer_metric_bindings_t *metric_buffer_ptr); |
|---|
| 121 | |
|---|
| 122 | /* Register metric */ |
|---|
| 123 | void __libarm4_shm_register_metric (unsigned char *digest_ptr, |
|---|
| 124 | const arm_id_t *app_id_ptr, |
|---|
| 125 | const char *metric_name_ptr, |
|---|
| 126 | const arm_metric_format_t metric_format, |
|---|
| 127 | const arm_metric_usage_t metric_usage, |
|---|
| 128 | const arm_char_t *metric_unit_ptr, |
|---|
| 129 | const int metric_index); |
|---|
| 130 | |
|---|
| 131 | void __libarm4_shm_get_uuid (arm_id_t *uuid_ptr); |
|---|
| 132 | |
|---|
| 133 | void __libarm4_shm_trace_arm (const char *string_ptr); |
|---|
| 134 | void __libarm4_shm_trace_arm_internal (const char *string_ptr); |
|---|
| 135 | void __libarm4_shm_trace_arm_shm (const char *string_ptr); |
|---|
| 136 | void __libarm4_shm_trace_arm_shm_internal (const char *string_ptr); |
|---|
| 137 | |
|---|
| 138 | #endif /* LIBARM4_SHM_H */ |
|---|