Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pal_memory.c Source File

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 "mbed-trace/mbed_trace.h"
00025 #include "mbed_stats.h"
00026 
00027 #define TRACE_GROUP "PALM"
00028 void printMemoryStats(void)
00029 {
00030     mbed_stats_heap_t heap_stats;
00031     mbed_stats_heap_get(&heap_stats);
00032 
00033     mbed_stats_stack_t stack_stats;
00034     mbed_stats_stack_get(&stack_stats);
00035     tr_info("--- heap stats ---\n");
00036 
00037     tr_info("heap max size: %ld\n", heap_stats.max_size);
00038     tr_info("heap reserved size: %ld\n", heap_stats.reserved_size);
00039     tr_info("heap alloc cnt: %ld\n", heap_stats.alloc_cnt);
00040     tr_info("heap alloc fail cnt: %ld\n", heap_stats.alloc_fail_cnt);
00041 
00042     tr_info("--- stack stats ---\n");
00043     tr_info("stack max size: %ld\n", stack_stats.max_size);
00044     tr_info("stack reserved size: %ld\n", stack_stats.reserved_size);
00045     tr_info("stack stack cnt: %ld\n", stack_stats.stack_cnt);
00046 
00047 }
00048 #endif