1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /*
- * Copyright Institute of Communication and Computer Systems (ICCS)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- /**
- * @file statistics.h
- * @author Ioannis Koutras (joko@microlab.ntua.gr)
- * @date September 2012
- * @brief Statistics function.
- */
- #ifndef DMMLIB_STATISTICS_H_
- #define DMMLIB_STATISTICS_H_
- #include <dmmlib/config.h>
- #ifdef WITH_ALLOCATOR_STATS
- #include <inttypes.h>
- #include "dmmlib/dmmlib.h"
- #include "dmmlib/dmmstats.h"
- #include "locks.h"
- #ifdef REQUEST_SIZE_INFO
- /** Updates the global statistics for specific dmmlib events */
- #define UPDATE_GLOBAL_STATS(EVENT_TYPE, REQ_SIZE) \
- DEALY_LOCK(tls_allocator->edit_lock); \
- update_stats(&systemallocator->dmm_stats, EVENT_TYPE, REQ_SIZE); \
- DEALY_UNLOCK(tls_allocator->edit_lock);
- #else /* REQUEST_SIZE_INFO */
- /** Updates the global statistics for specific dmmlib events */
- #define UPDATE_GLOBAL_STATS(EVENT_TYPE) \
- DEALY_LOCK(tls_allocator->edit_lock); \
- update_stats(&systemallocator->dmm_stats, EVENT_TYPE); \
- DEALY_UNLOCK(tls_allocator->edit_lock);
- #endif /* REQUEST_SIZE_INFO */
- /** DMM event type enumeration */
- typedef enum dmm_event_type_en
- { MALLOC
- , FREE
- #ifdef WITH_REALLOC
- , REALLOC_LT
- , REALLOC_GT
- #endif /* WITH_REALLOC */
- #ifdef WITH_MEMALIGN
- , MEMALIGN
- #endif /* WITH_MEMALIGN */
- } dmm_event_type;
- void update_stats
- ( dmmstats_t *dmm_stats
- , dmm_event_type event
- #ifdef REQUEST_SIZE_INFO
- , size_t mem_req
- #endif /* REQUEST_SIZE_INFO */
- );
- #else /* WITH_ALLOCATOR_STATS */
- /** Does nothing */
- #define UPDATE_GLOBAL_STATS(...)
- #endif /* WITH_ALLOCATOR_STATS */
- #endif /* DMMLIB_STATISTICS_H_ */
|