Changeset cc36562b in mainline for uspace/lib/posix
- Timestamp:
- 2018-08-25T19:06:27Z (8 years ago)
- Children:
- 72df613
- Parents:
- 02f547f
- Location:
- uspace/lib/posix
- Files:
-
- 2 edited
-
include/posix/time.h (modified) (2 diffs)
-
src/time.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/include/posix/time.h
r02f547f rcc36562b 42 42 43 43 #include "libc/time.h" 44 45 #undef CLOCKS_PER_SEC46 #define CLOCKS_PER_SEC (1000000L)47 44 48 45 #ifndef __locale_t_defined … … 102 99 const struct timespec *rqtp, struct timespec *rmtp); 103 100 104 /* CPU Time */105 extern clock_t clock(void);106 107 101 #endif // POSIX_TIME_H_ 108 102 -
uspace/lib/posix/src/time.c
r02f547f rcc36562b 49 49 #include "libc/malloc.h" 50 50 #include "libc/task.h" 51 #include "libc/stats.h"52 51 #include "libc/stddef.h" 53 52 #include "libc/time.h" … … 311 310 } 312 311 313 /**314 * Get CPU time used since the process invocation.315 *316 * @return Consumed CPU cycles by this process or -1 if not available.317 */318 clock_t clock(void)319 {320 clock_t total_cycles = -1;321 stats_task_t *task_stats = stats_get_task(task_get_id());322 if (task_stats) {323 total_cycles = (clock_t) (task_stats->kcycles +324 task_stats->ucycles);325 free(task_stats);326 task_stats = 0;327 }328 329 return total_cycles;330 }331 332 312 int gettimeofday(struct timeval *tv, void *tz) 333 313 {
Note:
See TracChangeset
for help on using the changeset viewer.
