Changeset 1ab8539 in mainline for uspace/app/tester/ipc/starve.c


Ignore:
Timestamp:
2014-11-14T19:16:23Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5042706
Parents:
9696b01
Message:

remove system.uptime sysinfo entry since it is redundant
cleanup the time handling routines

  • still more cleanup is needed here, the code is a wild combination of quasi-POSIX API (with all the brain-dead types, etc.) and HelenOS API
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/ipc/starve.c

    r9696b01 r1ab8539  
    4040        const char *err = NULL;
    4141        console_ctrl_t *console = console_init(stdin, stdout);
    42         if (console == NULL) {
     42        if (console == NULL)
    4343                return "Failed to init connection with console.";
    44         }
    4544       
    4645        struct timeval start;
    47         if (gettimeofday(&start, NULL) != 0) {
    48                 err = "Failed getting the time";
    49                 goto leave;
    50         }
     46        gettimeofday(&start, NULL);
    5147       
    5248        TPRINTF("Intensive computation shall be imagined (for %ds)...\n", DURATION_SECS);
     
    5450        while (true) {
    5551                struct timeval now;
    56                 if (gettimeofday(&now, NULL) != 0) {
    57                         err = "Failed getting the time";
    58                         goto leave;
    59                 }
     52                gettimeofday(&now, NULL);
    6053               
    6154                if (tv_sub(&now, &start) >= DURATION_SECS * 1000000L)
     
    7063                }
    7164        }
    72 
     65       
    7366        // FIXME - unless a key was pressed, the answer leaked as no one
    7467        // will wait for it.
    7568        // We cannot use async_forget() directly, though. Something like
    7669        // console_forget_pending_kbd_event() shall come here.
    77 
     70       
    7871        TPRINTF("Terminating...\n");
    79 
    80 leave:
     72       
    8173        console_done(console);
    82 
     74       
    8375        return err;
    8476}
Note: See TracChangeset for help on using the changeset viewer.