
Example usage of the mbed_stats_thread_get_each API.
main.cpp
- Committer:
- mbed_official
- Date:
- 2019-09-27
- Revision:
- 24:f9848efc84bc
- Parent:
- 15:6bca4e2b1a14
File content as of revision 24:f9848efc84bc:
/* Copyright (c) 2018 Arm Limited * * SPDX-License-Identifier: Apache-2.0 * * 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. */ #include "mbed.h" #if !defined(MBED_THREAD_STATS_ENABLED) #error "Stats not enabled" #endif #define MAX_THREAD_STATS 0x8 int main() { mbed_stats_thread_t *stats = new mbed_stats_thread_t[MAX_THREAD_STATS]; int count = mbed_stats_thread_get_each(stats, MAX_THREAD_STATS); for(int i = 0; i < count; i++) { printf("ID: 0x%x \n", stats[i].id); printf("Name: %s \n", stats[i].name); printf("State: %d \n", stats[i].state); printf("Priority: %d \n", stats[i].priority); printf("Stack Size: %d \n", stats[i].stack_size); printf("Stack Space: %d \n", stats[i].stack_space); printf("\n"); } return 0; }