RTEMS Size Information on printf, gmtime, etc
Joel Sherrill
joel.sherrill@oarcorp.com
Thu Sep 4 14:54:00 GMT 2014
Hi
I thought having something to compare to on an architecture
with less than the densest code might provide some insight.
The code is attached. Most RTEMS applications are statically
linked including the RTOS services needed, libc services needed,
BSP startup and shutdown, etc. I started with the Init()
task only having a call to exit(0) and then progressively added
calls so we could see what each added.
- sparc v7 (erc32) at -O2
- start up, single task, exit(0)
base:
66688 1408 7856 75952 128b0 o-optimize/time01.exe
add start and end printf (constant strings):
73616 1408 7856 82880 143c0 o-optimize/time01.exe
add call to time():
75840 1408 7856 85104 14c70 o-optimize/time01.exe
add gmtime call()
77888 1472 7856 87216 154b0 o-optimize/time01.exe
add printf() to print MM/DD/YY HH::MM::SS
106720 1600 7856 116176 1c5d0 o-optimize/time01.exe
I hope this provides a useful set of data.
I am happy to tinker if you want to see other the impact of other methods
or repeat this on other architectures. I can repeat this for 17
architectures
but I hope we don't need to check them all. :)
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
-------------- next part --------------
/*
* printf(), time(), and gmtime() size determination helper
*/
#include <rtems.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
rtems_task Init(
rtems_task_argument ignored
)
{
time_t now;
struct tm *tmp;
printf( "\n\n*** TIME/PRINTF SIZE TEST ***\n" );
now = time(&now);
tmp = gmtime(&now);
printf(
"NOW: %d/%d/%d %d:%d:%d\n",
tmp->tm_mon,
tmp->tm_mday,
tmp->tm_year,
tmp->tm_hour,
tmp->tm_min,
tmp->tm_sec
);
printf( "*** END OF TIME/PRINTF SIZE TEST ***\n" );
exit( 0 );
}
/* configuration information */
#include <bsp.h>
/* NOTICE: the clock driver is explicitly disabled */
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */
More information about the Newlib
mailing list