| 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 ARM4_DB_H /* Prevent multiple inclusion */ |
|---|
| 13 | #define ARM4_DB_H 1 |
|---|
| 14 | |
|---|
| 15 | /* Database record structures */ |
|---|
| 16 | typedef struct property_record { |
|---|
| 17 | arm_char_t name [ARM_PROPERTY_NAME_MAX_LENGTH]; |
|---|
| 18 | arm_char_t value [ARM_PROPERTY_VALUE_MAX_LENGTH]; |
|---|
| 19 | } property_record_t; |
|---|
| 20 | |
|---|
| 21 | typedef struct indexed_property_name_record { |
|---|
| 22 | int index; |
|---|
| 23 | arm_char_t name [ARM_PROPERTY_NAME_MAX_LENGTH]; |
|---|
| 24 | } indexed_property_name_record_t; |
|---|
| 25 | |
|---|
| 26 | typedef struct indexed_property_value_record { |
|---|
| 27 | int index; |
|---|
| 28 | arm_char_t value [ARM_PROPERTY_VALUE_MAX_LENGTH]; |
|---|
| 29 | } indexed_property_value_record_t; |
|---|
| 30 | |
|---|
| 31 | typedef struct handle_list_record { |
|---|
| 32 | arm_int64_t handle; |
|---|
| 33 | struct handle_list_record *next_ptr; |
|---|
| 34 | } handle_list_record_t; |
|---|
| 35 | |
|---|
| 36 | typedef struct application_record { |
|---|
| 37 | arm_char_t application_name [ARM_NAME_MAX_LENGTH]; |
|---|
| 38 | char md5_digest [MD5_DIGEST_LENGTH]; |
|---|
| 39 | arm_charset_t charset; |
|---|
| 40 | arm4_shm_transaction_trace_t default_trace_flags; |
|---|
| 41 | arm_int64_t default_trace_parameter; |
|---|
| 42 | arm_int64_t default_appdex_threshold; |
|---|
| 43 | } application_record_t; |
|---|
| 44 | |
|---|
| 45 | typedef struct application_instance_record { |
|---|
| 46 | arm_id_t appl_id; |
|---|
| 47 | arm_boolean_t active; |
|---|
| 48 | } application_instance_record_t; |
|---|
| 49 | |
|---|
| 50 | typedef struct application_address_record { |
|---|
| 51 | arm_int16_t address_format; |
|---|
| 52 | arm_int16_t address_length; |
|---|
| 53 | arm_uint8_t address [ARM_PROPERTY_URI_MAX_LENGTH]; |
|---|
| 54 | arm_boolean_t id_valid; |
|---|
| 55 | arm_id_t id; |
|---|
| 56 | } application_address_record_t; |
|---|
| 57 | |
|---|
| 58 | typedef struct transaction_record { |
|---|
| 59 | arm_char_t transaction_name [ARM_NAME_MAX_LENGTH]; |
|---|
| 60 | char md5_digest [MD5_DIGEST_LENGTH]; |
|---|
| 61 | arm_id_t appl_id; |
|---|
| 62 | arm4_shm_transaction_trace_t trace_flags; |
|---|
| 63 | arm4_appdex_t appdex_flags; |
|---|
| 64 | arm_int64_t trace_parameter; |
|---|
| 65 | arm_int64_t appdex_threshold; |
|---|
| 66 | } transaction_record_t; |
|---|
| 67 | |
|---|
| 68 | /* |
|---|
| 69 | * This record is used for the in-memory records by the libarm library, as well as |
|---|
| 70 | * by the Berkeley DB. |
|---|
| 71 | */ |
|---|
| 72 | |
|---|
| 73 | typedef struct transaction_instance_record { |
|---|
| 74 | arm_id_t appl_id; |
|---|
| 75 | arm_id_t tran_id; |
|---|
| 76 | arm_app_start_handle_t app_handle; |
|---|
| 77 | arm_time_t arrival_time; |
|---|
| 78 | arm_time_t stop_time; |
|---|
| 79 | arm_time_t response_time; |
|---|
| 80 | arm_tran_status_t tran_status; |
|---|
| 81 | arm_boolean_t active; |
|---|
| 82 | arm_time_t block_start_time; |
|---|
| 83 | arm_time_t blocked_time; |
|---|
| 84 | } transaction_instance_record_t; |
|---|
| 85 | |
|---|
| 86 | typedef struct metric_record { |
|---|
| 87 | arm_char_t metric_name [ARM_NAME_MAX_LENGTH]; |
|---|
| 88 | arm_char_t metric_units [ARM_NAME_MAX_LENGTH]; |
|---|
| 89 | char md5_digest [MD5_DIGEST_LENGTH]; |
|---|
| 90 | arm_id_t appl_id; |
|---|
| 91 | arm_metric_format_t metric_format; |
|---|
| 92 | arm_metric_usage_t metric_usage; |
|---|
| 93 | } metric_record_t; |
|---|
| 94 | |
|---|
| 95 | typedef struct metric_value_record |
|---|
| 96 | { |
|---|
| 97 | arm_metric_t value; |
|---|
| 98 | arm_char_t string32 [ARM_METRIC_STRING32_MAX_LENGTH]; |
|---|
| 99 | } metric_value_record_t; |
|---|
| 100 | |
|---|
| 101 | typedef struct user_record |
|---|
| 102 | { |
|---|
| 103 | char name [ARM_PROPERTY_NAME_MAX_LENGTH]; |
|---|
| 104 | arm_boolean_t id_valid; |
|---|
| 105 | arm_id_t id; |
|---|
| 106 | } user_record_t; |
|---|
| 107 | |
|---|
| 108 | #ifdef __cplusplus |
|---|
| 109 | |
|---|
| 110 | #include <list> |
|---|
| 111 | |
|---|
| 112 | typedef struct arm4db_application_summary { |
|---|
| 113 | arm_id_t appl_id; |
|---|
| 114 | arm_char_t application_name [ARM_NAME_MAX_LENGTH]; |
|---|
| 115 | arm_charset_t charset; |
|---|
| 116 | std::list<property_record_t *> identity_properties; |
|---|
| 117 | std::list<indexed_property_name_record_t *> context_names; |
|---|
| 118 | arm4_shm_transaction_trace_t default_trace_flags; |
|---|
| 119 | arm_int64_t default_trace_parameter; |
|---|
| 120 | arm_int64_t default_appdex_threshold; |
|---|
| 121 | } arm4db_application_summary_t; |
|---|
| 122 | |
|---|
| 123 | typedef struct arm4db_transaction_summary { |
|---|
| 124 | arm_id_t tran_id; |
|---|
| 125 | arm_id_t appl_id; |
|---|
| 126 | arm_char_t transaction_name [ARM_NAME_MAX_LENGTH]; |
|---|
| 127 | std::list<property_record_t *> identity_properties; |
|---|
| 128 | std::list<indexed_property_name_record_t *> context_names; |
|---|
| 129 | arm_char_t uri [ARM_PROPERTY_URI_MAX_LENGTH]; |
|---|
| 130 | arm4_shm_transaction_trace_t trace_flags; |
|---|
| 131 | arm4_appdex_t appdex_flags; |
|---|
| 132 | arm_int64_t trace_parameter; |
|---|
| 133 | arm_int64_t appdex_threshold; |
|---|
| 134 | } arm4db_transaction_summary_t; |
|---|
| 135 | |
|---|
| 136 | typedef struct arm4db_transaction_trace_stats { |
|---|
| 137 | arm_id_t tran_id; |
|---|
| 138 | arm_int64_t transaction_counter; |
|---|
| 139 | } arm4db_transaction_trace_stats_t; |
|---|
| 140 | |
|---|
| 141 | typedef struct arm4db_appdex_stats { |
|---|
| 142 | arm_id_t tran_id; |
|---|
| 143 | arm_int64_t appdex_satisfactory; |
|---|
| 144 | arm_int64_t appdex_tolerable; |
|---|
| 145 | arm_int64_t appdex_frustrating; |
|---|
| 146 | } arm4db_appdex_stats_t; |
|---|
| 147 | |
|---|
| 148 | #endif // __cplusplus |
|---|
| 149 | |
|---|
| 150 | #endif /* ARM4_DB_H */ |
|---|