From c5ac8332de6200c36094b057cd9cdb2196099ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Tue, 5 Aug 2014 19:13:23 +0200 Subject: [PATCH] "tests": print tcb_t size The "test" should aid #303. --- tests/sizeof_tcb/Makefile | 4 +++ tests/sizeof_tcb/main.c | 52 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tests/sizeof_tcb/Makefile create mode 100644 tests/sizeof_tcb/main.c diff --git a/tests/sizeof_tcb/Makefile b/tests/sizeof_tcb/Makefile new file mode 100644 index 0000000000..72f8fb3520 --- /dev/null +++ b/tests/sizeof_tcb/Makefile @@ -0,0 +1,4 @@ +APPLICATION = sizeof_tcb +include ../Makefile.tests_common + +include $(RIOTBASE)/Makefile.include diff --git a/tests/sizeof_tcb/main.c b/tests/sizeof_tcb/main.c new file mode 100644 index 0000000000..f1b7ef9ef7 --- /dev/null +++ b/tests/sizeof_tcb/main.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2014 René Kijewski + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Print the size of tcb_t. + * + * @author René Kijewski + * + * @} + */ + +#include +#include + +#include "tcb.h" + +#define P(NAME) printf("\t%-*s%4zu%4zu\n", 11, #NAME, sizeof(((tcb_t *) 0)->NAME), offsetof(tcb_t, NAME)); + +int main(void) +{ + puts("\tmember, sizeof, offsetof"); + + printf("sizeof(tcb_t): %zu\n", sizeof(tcb_t)); + + P(sp); + P(status); + P(pid); + P(priority); + P(rq_entry); + P(wait_data); + P(msg_waiters); + P(msg_queue); + P(msg_array); + P(name); + P(stack_start); + +#ifdef DEVELHELP + P(stack_size); +#endif + + puts("Done."); + return 0; +}