public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* RTEMS Size Information on printf, gmtime, etc
@ 2014-09-04 14:54 Joel Sherrill
  0 siblings, 0 replies; only message in thread
From: Joel Sherrill @ 2014-09-04 14:54 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

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


[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 1001 bytes --]

/*
 *  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 */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-04 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 14:54 RTEMS Size Information on printf, gmtime, etc Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).