Simple interface for Mbed Cloud Client
Embed:
(wiki syntax)
Show/hide line numbers
pal_memory.c
00001 /******************************************************************************* 00002 * Copyright 2016, 2017 ARM Ltd. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 *******************************************************************************/ 00016 /* 00017 * pal_memory.c 00018 * 00019 * Created on: Jun 26, 2017 00020 * Author: pal 00021 */ 00022 #ifdef PAL_MEMORY_STATISTICS 00023 00024 #include "stdio.h" 00025 #include "mbed-trace/mbed_trace.h" 00026 #include "mbed_stats.h" 00027 00028 #define TRACE_GROUP "PALM" 00029 void printMemoryStats(void) 00030 { 00031 mbed_stats_heap_t heap_stats; 00032 mbed_stats_heap_get(&heap_stats); 00033 00034 mbed_stats_stack_t stack_stats; 00035 mbed_stats_stack_get(&stack_stats); 00036 tr_info("--- heap stats ---\n"); 00037 00038 tr_info("heap max size: %ld\n", heap_stats.max_size); 00039 tr_info("heap reserved size: %ld\n", heap_stats.reserved_size); 00040 tr_info("heap alloc cnt: %ld\n", heap_stats.alloc_cnt); 00041 tr_info("heap alloc fail cnt: %ld\n", heap_stats.alloc_fail_cnt); 00042 00043 tr_info("--- stack stats ---\n"); 00044 tr_info("stack max size: %ld\n", stack_stats.max_size); 00045 tr_info("stack reserved size: %ld\n", stack_stats.reserved_size); 00046 tr_info("stack stack cnt: %ld\n", stack_stats.stack_cnt); 00047 00048 } 00049 #endif
Generated on Tue Jul 12 2022 19:01:36 by 1.7.2