Changeset 23 for trunk/kernel/kern/time.h
- Timestamp:
- Jun 18, 2017, 10:06:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/time.h
r1 r23 1 1 /* 2 * time.h : thread time related management2 * time.h - Structure used by gettimeofday. 3 3 * 4 * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless 5 * Copyright (c) 2011,2012 UPMC Sorbonne Universites 4 * author Alain Greiner (2016,2017) 6 5 * 7 * This file is part of ALMOS-kernel.6 * Copyright (c) UPMC Sorbonne Universites 8 7 * 9 * ALMOS-kernel is free software; you can redistribute it and/or modify it 8 * This file is part of ALMOS-MKH. 9 * 10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 10 11 * under the terms of the GNU General Public License as published by 11 12 * the Free Software Foundation; version 2.0 of the License. 12 13 * 13 * ALMOS- kernelis distributed in the hope that it will be useful, but14 * ALMOS-MKH is distributed in the hope that it will be useful, but 14 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 17 18 * 18 19 * You should have received a copy of the GNU General Public License 19 * along with ALMOS- kernel; if not, write to the Free Software Foundation,20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 20 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 22 */ … … 24 25 #define _TIME_H_ 25 26 26 #include <types.h> 27 #include <list.h> 28 #include <device.h> 27 #include <hal_types.h> 29 28 30 struct event_s;31 29 32 struct alarm_info_s30 struct timeval 33 31 { 34 uint_t signature; 35 36 /* Public members */ 37 struct event_s *event; 38 39 /* Private members */ 40 uint_t tm_wakeup; 41 struct list_entry list; 32 uint32_t tv_sec; /* secondes */ 33 uint32_t tv_usec; /* microsecondes */ 42 34 }; 43 35 44 struct alarm_s 45 { 46 struct list_entry wait_queue; 47 }; 48 49 50 struct timeb { 51 time_t time; 52 unsigned short millitm; 53 short timezone; 54 short dstflag; 55 }; 56 57 struct timeval { 58 clock_t tv_sec; /* secondes */ 59 clock_t tv_usec; /* microsecondes */ 60 }; 61 62 struct timezone { 36 struct timezone 37 { 63 38 int tz_minuteswest; /* minutes west of Greenwich */ 64 39 int tz_dsttime; /* type of DST correction */ 65 40 }; 66 41 67 68 struct tms69 {70 clock_t tms_utime; /* user time */71 clock_t tms_stime; /* system time */72 clock_t tms_cutime; /* user time of children */73 clock_t tms_cstime; /* system time of children */74 };75 76 77 error_t alarm_manager_init(struct alarm_s *alarm);78 error_t alarm_wait(struct alarm_info_s *info, uint_t msec);79 80 void alarm_clock(struct alarm_s *alarm, uint_t ticks_nr);81 82 int sys_clock (uint64_t *val);83 int sys_alarm (unsigned nb_sec);84 int sys_ftime (struct timeb *utime);85 int sys_times(struct tms *utms);86 int sys_gettimeofday(struct timeval *tv, struct timezone *tz);87 88 #if CONFIG_THREAD_TIME_STAT89 struct thread_s;90 inline void tm_sleep_compute(struct thread_s *thread);91 inline void tm_usr_compute(struct thread_s *thread);92 inline void tm_sys_compute(struct thread_s *thread);93 inline void tm_wait_compute(struct thread_s *thread);94 inline void tm_exit_compute(struct thread_s *thread);95 inline void tm_born_compute(struct thread_s *thread);96 inline void tm_create_compute(struct thread_s *thread);97 98 #else99 100 #define tm_sleep_compute(thread)101 #define tm_usr_compute(thread)102 #define tm_sys_compute(thread)103 #define tm_wait_compute(thread)104 #define tm_exit_compute(thread)105 #define tm_born_compute(thread)106 #define tm_create_compute(thread)107 108 #endif /* CONFIG_SCHED_STAT */109 110 42 #endif /* _TIME_H_ */
Note: See TracChangeset
for help on using the changeset viewer.