Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 79edc36 in mainline for uspace/app/top/input.c


Ignore:
Timestamp:
2010-04-01T15:21:03Z (12 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master
Children:
62550dce
Parents:
83a957a
Message:

System load echo fix, now it looks realistic
top echoes first values (uptime)
Several ps and uptime fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/top/input.c

    r83a957a r79edc36  
    6262#include <ipc/console.h>
    6363
    64 #define READ_TIMEOUT 1000000
     64#define USEC_COUNT 1000000
    6565
    6666/* return true iff the given timeval is positive */
     
    154154 * Eat any input that might be available.
    155155 */
    156 void tsleep(void)
     156void tsleep(unsigned int sec)
    157157{
    158158        struct timeval tv;
    159159       
    160160        tv.tv_sec = 0;
    161         tv.tv_usec = READ_TIMEOUT;
     161        tv.tv_usec = sec * USEC_COUNT;
    162162        while (TV_POS(&tv))
    163163                if (rwait(&tv)) {
     
    170170 * getchar with timeout.
    171171 */
    172 int tgetchar(void)
     172int tgetchar(unsigned int sec)
    173173{
    174174        static struct timeval timeleft;
     
    176176       
    177177        /*
    178          * Reset timeleft to READ_TIMEOUT whenever it is not positive.
     178         * Reset timeleft to USEC_COUNT whenever it is not positive.
    179179         * In any case, wait to see if there is any input.  If so,
    180180         * take it, and update timeleft so that the next call to
     
    186186        if (!TV_POS(&timeleft)) {
    187187                timeleft.tv_sec = 0;
    188                 timeleft.tv_usec = READ_TIMEOUT;
     188                timeleft.tv_usec = sec * USEC_COUNT;
    189189        }
    190190       
Note: See TracChangeset for help on using the changeset viewer.