1 /* ``Licensed under the Apache License, Version 2.0 (the "License"); 2 * you may not use this file except in compliance with the License. 3 * You may obtain a copy of the License at 4 * 5 * http://www.apache.org/licenses/LICENSE-2.0 6 * 7 * Unless required by applicable law or agreed to in writing, software 8 * distributed under the License is distributed on an "AS IS" BASIS, 9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 * See the License for the specific language governing permissions and 11 * limitations under the License. 12 * 13 * The Initial Developer of the Original Code is Ericsson Utvecklings AB. 14 * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings 15 * AB. All Rights Reserved.'' 16 * 17 * $Id$ 18 */ 19 20 21 /* 22 * Description: 23 * 24 * Author: Rickard Green 25 */ 26 27 #ifndef ERL_MEMORY_TRACE_BLOCK_TABLE_H__ 28 #define ERL_MEMORY_TRACE_BLOCK_TABLE_H__ 29 30 #include <stdlib.h> 31 #include "erl_fixed_size_int_types.h" 32 #include "erl_memory_trace_parser.h" 33 34 35 #define EMTBT_ALLOC_XBLK_ERROR (EMTP_MIN_ERROR - 1) 36 #define EMTBT_REALLOC_NOBLK_ERROR (EMTP_MIN_ERROR - 2) 37 #define EMTBT_REALLOC_XBLK_ERROR (EMTP_MIN_ERROR - 3) 38 #define EMTBT_REALLOC_BLK_TYPE_MISMATCH (EMTP_MIN_ERROR - 4) 39 #define EMTBT_FREE_NOBLK_ERROR (EMTP_MIN_ERROR - 5) 40 #define EMTBT_FREE_BLK_TYPE_MISMATCH (EMTP_MIN_ERROR - 6) 41 #define EMTBT_INTERNAL_ERROR (EMTP_MIN_ERROR - 7) 42 43 #define EMTBT_MIN_ERROR EMTBT_INTERNAL_ERROR 44 45 46 typedef struct emtbt_block_ { 47 48 struct emtbt_block_ * next; 49 struct emtbt_block_ * prev; 50 usgnd_int_32 hash; 51 struct emtbt_block_ ** bucket; 52 53 struct { 54 usgnd_int_32 secs; 55 usgnd_int_32 usecs; 56 } time; 57 usgnd_int_16 type; 58 usgnd_int_max pointer; 59 usgnd_int_max size; 60 } emtbt_block; 61 62 typedef struct emtbt_table_ emtbt_table; 63 64 const char *emtbt_error_string(int); 65 emtbt_table *emtbt_new_table(int, 66 void * (*)(size_t), 67 void * (*)(void *, size_t), 68 void (*)(void *)); 69 void emtbt_destroy_table(emtbt_table *); 70 int emtbt_alloc_op(emtbt_table *tab, emtp_operation *op); 71 int emtbt_realloc_op(emtbt_table *, emtp_operation *, emtbt_block *); 72 int emtbt_free_op(emtbt_table *, emtp_operation *, emtbt_block *); 73 74 #endif 75