]> Zhao Yanbai Git Server - minix.git/commitdiff
Support for SI_CALL_STATS (counting systemcalls).
authorPhilip Homburg <philip@cs.vu.nl>
Mon, 10 Jul 2006 12:44:43 +0000 (12:44 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Mon, 10 Jul 2006 12:44:43 +0000 (12:44 +0000)
servers/fs/main.c
servers/fs/misc.c
servers/pm/main.c
servers/pm/misc.c

index f69cb8db886864a4286d76493059a30cdd778e6e..59c9dfcba9c290e5c49d1595dbdd5490ccdc5134 100644 (file)
@@ -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])();
                }
 
index 40f77fcb5cf1077071363a3c86e3d3b77eaf0db5..bc2a8196680d7096a32ec59eb891caa6bededcd6 100644 (file)
 #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);
   }
index 274b538f3b9d3e3a305d84f4ffa5a4f6c7076642..3f23a856610a9cd5e92dda7a712d26abab392c28 100644 (file)
 #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;
index ca3d67f75e94f7e828397f9055489ede8cded2e4..1c795fe4adabbd692aca33366730589702d42638 100644 (file)
@@ -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);
   }