// < fche> -p2 will just expand the alias for you to the actual low level probes global block_start; global block_total; global start; global recursion_guard; global targetpid; // TODO: make a table of files read..then see if there are any non-firefox accesses to them probe begin { start = 0; block_total = 0; recursion_guard = 0; targetpid = -1; printf("BEGIN;\nDELETE FROM startup;\n"); } probe end { printf("END\;"); printf("-- %dus of ext4 reads unaccounted for\n", block_total); if (recursion_guard) printf("-- Oh noes, recursion_guard(%d) got out of control!\n", recursion_guard); } probe kernel.function("vfs_read"), kernel.function("vfs_readdir"), kernel.function("__do_page_cache_readahead") { if (targetpid == pid()) { if (!recursion_guard++); start = gettimeofday_us(); } } function report(path, pos, size) { fname = d_path(path); if (fname != "//") printf("INSERT INTO startup VALUES('%s', '%s', %d, %d, %d);\n", execname(), fname, pos, size, gettimeofday_us() - start); start = 0; } probe kernel.function("vfs_read").return { if (targetpid == pid()) { if (!--recursion_guard) if ($return > 0) report(&$file->f_path, $pos[0], $return); } } probe kernel.function("vfs_readdir").return { if (targetpid == pid()) { if (!--recursion_guard) if ($return > 0) report(&$file->f_path, 0, 0); } } probe kernel.function("__do_page_cache_readahead").return { if (targetpid == pid()) { if (!--recursion_guard) report(&$filp->f_path, $offset*4096, $nr_to_read*4096); } } probe kernel.function("ext4_get_block") { if (!start) block_start = gettimeofday_us(); } probe kernel.function("ext4_get_block").return { if(!start) block_total += gettimeofday_us() - block_start; } probe kernel.function("generic_file_open").return { if (targetpid == -1 && isinstr(execname(), "firefox")) { targetpid = pid() } }