From e0ffcdadd1910681c46ddaeb7bb5004a35871aa6 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 1 Jun 2005 09:34:18 +0000 Subject: [PATCH] Added support for lock()/unlock() timing registration; also phys_zero system call --- include/minix/com.h | 7 ++++++- include/minix/config.h | 12 +++++++++++- include/minix/syslib.h | 2 ++ include/minix/type.h | 11 +++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index 6121c516d..e52cf1a2b 100755 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -196,7 +196,6 @@ * modifying the system call numbers. The numbers here determine which call * is made from the call vector. */ -#define NR_SYS_CALLS 33 /* number of system calls */ # define SYS_TIMES 0 /* sys_times(proc_nr, bufptr) */ # define SYS_XIT 1 /* sys_xit(parent, proc) */ # define SYS_GETSIG 2 /* sys_getsig(proc_nr, sig_map) */ @@ -230,6 +229,8 @@ # define SYS_VIRCOPY 30 /* sys_vircopy(src,seg,addr,dst,seg,addr,cnt) */ # define SYS_PHYSCOPY 31 /* sys_physcopy(src_addr,dst_addr,count) */ # define SYS_VIRVCOPY 32 /* sys_virvcopy(vec_ptr, vec_size) */ +# define SYS_PHYSZERO 33 /* sys_physzero(addr,count) */ +#define NR_SYS_CALLS 34 /* number of system calls */ /* Field names for SYS_MEM, SYS_KMALLOC. */ #define MEM_CHUNK_BASE m4_l1 /* physical base address */ @@ -328,6 +329,7 @@ # define GET_SCHEDINFO 10 /* get scheduling queues */ # define GET_PROC 11 /* get process slot if given process */ # define GET_MACHINE 12 /* get machine information */ +# define GET_LOCKTIMING 13 /* get lock()/unlock() latency timing */ #define I_PROC_NR m7_i4 /* calling process */ #define I_VAL_PTR m7_p1 /* virtual address at caller */ #define I_VAL_LEN m7_i1 /* max length of value */ @@ -373,6 +375,9 @@ #define PR_IP_PTR m1_p3 /* initial value for ip after exec */ #define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */ +/* Field names for SYS_PHYSZERO */ +#define PZ_MEM_PTR m1_p1 /* base */ +#define PZ_COUNT m1_i1 /* count */ /*===========================================================================* * Miscellaneous messages, mainly used by IS * diff --git a/include/minix/config.h b/include/minix/config.h index 6d8ccb4f3..51d81f7ed 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -122,7 +122,17 @@ #define NR_RS_LINES 0 /* # rs232 terminals (0 to 4) */ #define NR_PTYS 32 /* # pseudo terminals (0 to 64) */ -#define ENABLE_MESSAGE_STATS 0 +/* these timing functions use quite a bit more kernel memory to hold + * timing data. + */ +#define ENABLE_INT_TIMING 0 +#define ENABLE_LOCK_TIMING 0 + +#if ENABLE_LOCK_TIMING +#define TIMING_POINTS 20 +#define TIMING_CATEGORIES 20 +#define TIMING_NAME 10 +#endif /*===========================================================================* * There are no user-settable parameters after this line * diff --git a/include/minix/syslib.h b/include/minix/syslib.h index 2e034255a..7c2d89554 100755 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -102,6 +102,7 @@ _PROTOTYPE(int sys_vircopy, (int src_proc, int src_seg, vir_bytes src_vir, sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes) _PROTOTYPE(int sys_physcopy, (int src_proc, int src_seg, vir_bytes src_vir, int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes) ); +_PROTOTYPE(int sys_physzero, (phys_bytes base, phys_bytes bytes) ); _PROTOTYPE(int sys_umap, (int proc_nr, int seg, vir_bytes vir_addr, vir_bytes bytes, phys_bytes *phys_addr) ); @@ -124,6 +125,7 @@ _PROTOTYPE(int sys_kmalloc, (size_t size, phys_bytes *phys_base) ); #define sys_getkenv(k,kl,v,vl) sys_getinfo(GET_KENV, v,vl, k,kl) #define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0) #define sys_getkaddr(dst) sys_getinfo(GET_KADDRESSES, dst, 0,0,0) +#define sys_getlocktimings(dst) sys_getinfo(GET_LOCKTIMING, dst, 0,0,0) _PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len, void *key_ptr, int key_len) ); _PROTOTYPE(int sys_exit, (int status) ); diff --git a/include/minix/type.h b/include/minix/type.h index 1869c3011..c78221778 100755 --- a/include/minix/type.h +++ b/include/minix/type.h @@ -119,4 +119,15 @@ struct machine { int vdu_vga; }; +/* Timing data of lock()/unlock() sequences, if selected to be compiled in. */ + +#if ENABLE_LOCK_TIMING +struct lock_timedata { + char names[TIMING_NAME]; + unsigned long lock_timings[TIMING_POINTS]; + unsigned long lock_timings_range[2]; + unsigned long binsize, resets, misses, measurements; +}; +#endif + #endif /* _TYPE_H */