Changeset 5ee0701 in network-demos


Ignore:
Timestamp:
Aug 16, 2007, 5:27:52 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master, network-demos-4-10-branch, network-demos-4-8-branch, network-demos-4-9-branch
Children:
0cbc6db
Parents:
13bcedb
Message:

2007-08-16 Joel Sherrill <joel.sherrill@…>

  • init.c: Change clock tick to 1 millisecond.
  • rtems_ttcp.c: Add CPU usage reporting.
  • ttcp_orig/ttcp.c: Add -m option for delaying between writes.
Location:
ttcp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ttcp/ChangeLog

    r13bcedb r5ee0701  
     12007-08-16      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * init.c: Change clock tick to 1 millisecond.
     4        * rtems_ttcp.c: Add CPU usage reporting.
     5        * ttcp_orig/ttcp.c: Add -m option for delaying between writes.
     6
    172007-06-21      Joel Sherrill <joel.sherrill@OARcorp.com>
    28
  • ttcp/init.c

    r13bcedb r5ee0701  
    2828#define CONFIGURE_MAXIMUM_TASKS         20
    2929
    30 #define CONFIGURE_MICROSECONDS_PER_TICK 10000
     30#define CONFIGURE_MICROSECONDS_PER_TICK 1000
    3131
    3232#define CONFIGURE_INIT_TASK_STACK_SIZE  (10*1024)
  • ttcp/rtems_ttcp.c

    r13bcedb r5ee0701  
    8686rtems_ttcp_exit (int code)
    8787{
     88        rtems_cpu_usage_report();
    8889        rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) );
    8990        rtems_bsdnet_show_mbuf_stats ();
     
    161162                printf ("         -t destination.internet.address\n");
    162163        }
     164        rtems_cpu_usage_reset();
    163165        code = rtems_ttcp_main (argc, argv);
    164166        rtems_ttcp_exit (code);
  • ttcp/ttcp_orig/ttcp.c

    r13bcedb r5ee0701  
    4848/* #define SYSV */      /* required on SGI IRIX releases before 3.3 */
    4949
     50#define ENABLE_NANOSLEEP_DELAY
     51
    5052#include <stdio.h>
    5153#include <signal.h>
     
    5860#include <arpa/inet.h>
    5961#include <netdb.h>
     62#include <string.h>
    6063#include <sys/time.h>           /* struct timeval */
     64
     65#include <unistd.h>
     66#include <stdlib.h>
    6167
    6268#if defined(SYSV)
     
    107113                                 *  g = gigabits, G = gigabytes */
    108114int touchdata = 0;              /* access data after reading */
     115long milliseconds = 0;          /* delay in milliseconds */
    109116
    110117struct hostent *addr;
     
    134141        -B      for -s, only output full blocks as specified by -l (for TAR)\n\
    135142        -T      \"touch\": access each byte as it's read\n\
     143        -m ##   delay for specified milliseconds between each write\n\
    136144";     
    137145
     
    157165}
    158166
     167void millisleep(long msec)
     168{
     169#if defined(ENABLE_NANOSLEEP_DELAY)
     170  struct timespec req;
     171
     172  req.tv_sec = msec / 1000;
     173  req.tv_nsec = (msec % 1000) * 1000000;
     174
     175  nanosleep( &req, NULL );
     176#endif
     177}
    159178int main(argc,argv)
    160179int argc;
     
    166185        if (argc < 2) goto usage;
    167186
    168         while ((c = getopt(argc, argv, "drstuvBDTb:f:l:n:p:A:O:")) != -1) {
     187        while ((c = getopt(argc, argv, "drstuvBDTb:f:l:m:n:p:A:O:")) != -1) {
    169188                switch (c) {
    170189
     
    188207        "ttcp: -D option ignored: TCP_NODELAY socket option not supported\n");
    189208#endif
     209                        break;
     210                case 'm':
     211                        milliseconds = atoi(optarg);
     212                        #if !defined(ENABLE_NANOSLEEP_DELAY)
     213                                fprintf(stderr, "millisecond delay disabled\n");
     214                        #endif
    190215                        break;
    191216                case 'n':
     
    380405                        pattern( buf, buflen );
    381406                        if(udp)  (void)Nwrite( fd, buf, 4 ); /* rcvr start */
    382                         while (nbuf-- && Nwrite(fd,buf,buflen) == buflen)
     407                        while (nbuf-- && Nwrite(fd,buf,buflen) == buflen) {
    383408                                nbytes += buflen;
     409                                millisleep( milliseconds );
     410                        }
    384411                        if(udp)  (void)Nwrite( fd, buf, 4 ); /* rcvr end */
    385412                } else {
Note: See TracChangeset for help on using the changeset viewer.