Support for SI_CALL_STATS (counting systemcalls).
This commit is contained in:
		
							parent
							
								
									2cf649db2e
								
							
						
					
					
						commit
						7ce17fe655
					
				@ -33,6 +33,10 @@ struct super_block;		/* proto.h needs to know this */
 | 
			
		||||
#include "param.h"
 | 
			
		||||
#include "super.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
EXTERN unsigned long calls_stats[NCALLS];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
FORWARD _PROTOTYPE( void fs_init, (void)				);
 | 
			
		||||
FORWARD _PROTOTYPE( void get_work, (void)				);
 | 
			
		||||
FORWARD _PROTOTYPE( void init_root, (void)				);
 | 
			
		||||
@ -102,6 +106,9 @@ PUBLIC int main()
 | 
			
		||||
		"FS, bad process, who = %d, call_nr = %d, endpt1 = %d\n",
 | 
			
		||||
				 who_e, call_nr, m_in.endpt1);
 | 
			
		||||
		} else {
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
			calls_stats[call_nr]++;
 | 
			
		||||
#endif
 | 
			
		||||
			error = (*call_vec[call_nr])();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -38,6 +38,10 @@
 | 
			
		||||
#define CORE_NAME	"core"
 | 
			
		||||
#define CORE_MODE	0777	/* mode to use on core image files */
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
PUBLIC unsigned long calls_stats[NCALLS];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
FORWARD _PROTOTYPE( void free_proc, (struct fproc *freed, int flags));
 | 
			
		||||
FORWARD _PROTOTYPE( int dumpcore, (int proc_e, struct mem_map *seg_ptr));
 | 
			
		||||
FORWARD _PROTOTYPE( int write_bytes, (struct inode *rip, off_t off,
 | 
			
		||||
@ -80,6 +84,12 @@ PUBLIC int do_getsysinfo()
 | 
			
		||||
  	src_addr = (vir_bytes) dmap;
 | 
			
		||||
  	len = sizeof(struct dmap) * NR_DEVICES;
 | 
			
		||||
  	break; 
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
  case SI_CALL_STATS:
 | 
			
		||||
  	src_addr = (vir_bytes) calls_stats;
 | 
			
		||||
  	len = sizeof(calls_stats);
 | 
			
		||||
  	break; 
 | 
			
		||||
#endif
 | 
			
		||||
  default:
 | 
			
		||||
  	return(EINVAL);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -29,6 +29,10 @@
 | 
			
		||||
#include "../../kernel/type.h"
 | 
			
		||||
#include "../../kernel/proc.h"
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
EXTERN unsigned long calls_stats[NCALLS];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
FORWARD _PROTOTYPE( void get_work, (void)				);
 | 
			
		||||
FORWARD _PROTOTYPE( void pm_init, (void)				);
 | 
			
		||||
FORWARD _PROTOTYPE( int get_nice_value, (int queue)			);
 | 
			
		||||
@ -119,6 +123,9 @@ PUBLIC int main()
 | 
			
		||||
		if ((unsigned) call_nr >= NCALLS) {
 | 
			
		||||
			result = ENOSYS;
 | 
			
		||||
		} else {
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
			calls_stats[call_nr]++;
 | 
			
		||||
#endif
 | 
			
		||||
			result = (*call_vec[call_nr])();
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
@ -53,6 +53,10 @@ PRIVATE char *uts_tbl[] = {
 | 
			
		||||
  NULL,			/* No bus */			/* No bus */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
PUBLIC unsigned long calls_stats[NCALLS];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*===========================================================================*
 | 
			
		||||
 *				do_allocmem				     *
 | 
			
		||||
 *===========================================================================*/
 | 
			
		||||
@ -256,6 +260,12 @@ PUBLIC int do_getsysinfo()
 | 
			
		||||
        src_addr = (vir_bytes) &loadinfo;
 | 
			
		||||
        len = sizeof(struct loadinfo);
 | 
			
		||||
        break;
 | 
			
		||||
#if ENABLE_SYSCALL_STATS
 | 
			
		||||
  case SI_CALL_STATS:
 | 
			
		||||
  	src_addr = (vir_bytes) calls_stats;
 | 
			
		||||
  	len = sizeof(calls_stats);
 | 
			
		||||
  	break; 
 | 
			
		||||
#endif
 | 
			
		||||
  default:
 | 
			
		||||
  	return(EINVAL);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user