Changeset 06cb827 in mainline
- Timestamp:
- 2011-07-01T23:34:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fb872c1
- Parents:
- a43fbc95
- Location:
- uspace/lib/posix
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/time.c
ra43fbc95 r06cb827 38 38 #include "internal/common.h" 39 39 #include "time.h" 40 #include "libc/malloc.h" 41 #include <task.h> 42 #include <stats.h> 40 43 41 44 /** … … 85 88 // TODO 86 89 if (maxsize >= 1) { 87 *s = 0;90 *s = '\0'; 88 91 } 89 92 return 0; … … 91 94 92 95 /** 93 * 94 * @return 96 * Get CPU time used since the process invocation. 97 * 98 * @return Consumed CPU cycles by this process or -1 if not available. 95 99 */ 96 100 posix_clock_t posix_clock(void) 97 101 { 98 // TODO 99 return (posix_clock_t) -1; 102 posix_clock_t total_cycles = -1; 103 stats_task_t *task_stats = stats_get_task(task_get_id()); 104 if (task_stats) { 105 total_cycles = (posix_clock_t) (task_stats->kcycles + task_stats->ucycles); 106 } 107 free(task_stats); 108 task_stats = 0; 109 110 return total_cycles; 100 111 } 101 112 -
uspace/lib/posix/time.h
ra43fbc95 r06cb827 43 43 #endif 44 44 45 #undef CLOCKS_PER_SEC 46 #define CLOCKS_PER_SEC 1000000L 47 45 48 struct posix_tm { 46 49 int tm_sec; /* Seconds [0,60]. */
Note:
See TracChangeset
for help on using the changeset viewer.