Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/main.cfa

    r7223dbf2 r8c43d05  
    1010}
    1111
     12#include <fstream.hfa>
    1213#include <kernel.hfa>
    1314#include <iofwd.hfa>
     
    8384        //===================
    8485        // Open Files
    85         printf("Filling cache from %s\n", path);
     86        sout | "Filling cache from" | path;
    8687        fill_cache( path );
    8788
    8889        //===================
    8990        // Open Socket
    90         printf("%ld : Listening on port %d\n", getpid(), options.socket.port);
     91        sout | getpid() | ": Listening on port" | options.socket.port;
    9192        int server_fd = socket(AF_INET, SOCK_STREAM, 0);
    9293        if(server_fd < 0) {
     
    108109                        if(errno == EADDRINUSE) {
    109110                                if(waited == 0) {
    110                                         printf("Waiting for port\n");
     111                                        sout | "Waiting for port";
    111112                                } else {
    112                                         printf("\r%d", waited);
    113                                         fflush(stdout);
     113                                        sout | "\r" | waited | nonl;
     114                                        flush( sout );
    114115                                }
    115116                                waited ++;
     
    173174                                        unpark( workers[i] );
    174175                                }
    175                                 printf("%d workers started on %d processors\n", options.clopts.nworkers, options.clopts.nprocs);
     176                                sout | options.clopts.nworkers | "workers started on" | options.clopts.nprocs | "processors";
    176177                                {
    177178                                        char buffer[128];
     
    180181                                        }
    181182
    182                                         printf("Shutting Down\n");
    183                                 }
    184 
     183                                        sout | "Shutdown received";
     184                                }
     185
     186                                sout | "Notifying connections";
    185187                                for(i; options.clopts.nworkers) {
    186188                                        workers[i].done = true;
     
    188190                                }
    189191
    190                                 printf("Shutting down socket\n");
     192                                sout | "Shutting down socket";
    191193                                int ret = shutdown( server_fd, SHUT_RD );
    192194                                if( ret < 0 ) { abort( "shutdown error: (%d) %s\n", (int)errno, strerror(errno) ); }
     
    194196                                //===================
    195197                                // Close Socket
    196                                 printf("Closing Socket\n");
     198                                sout | "Closing Socket";
    197199                                ret = close( server_fd );
    198200                                if(ret < 0) {
    199201                                        abort( "close socket error: (%d) %s\n", (int)errno, strerror(errno) );
    200202                                }
     203                                sout | "Stopping connection threads..." | nonl;
    201204                        }
    202                         printf("Workers Closed\n");
    203 
     205                        sout | "done";
     206
     207                        sout | "Stopping protocol threads..." | nonl;
    204208                        deinit_protocol();
    205                 }
    206 
     209                        sout | "done";
     210
     211                        sout | "Stopping processors..." | nonl;
     212                }
     213                sout | "done";
     214
     215                sout | "Closing splice fds..." | nonl;
    207216                for(i; pipe_cnt) {
    208217                        ret = close( fds[pipe_off + i] );
     
    212221                }
    213222                free(fds);
    214 
    215         }
     223                sout | "done";
     224
     225                sout | "Stopping processors..." | nonl;
     226        }
     227        sout | "done";
    216228
    217229        //===================
    218230        // Close Files
    219         printf("Closing Files\n");
     231        sout | "Closing open files..." | nonl;
    220232        close_cache();
    221 }
     233        sout | "done";
     234}
Note: See TracChangeset for help on using the changeset viewer.