Find the answer to your Linux question:
Results 1 to 2 of 2
Hello i am a beginner at linux programming and i am trying to do simple tasks to see how the code responds. I i want to test the performance of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2003
    Posts
    2

    Simple scripting and kernel changes...


    Hello i am a beginner at linux programming and i am trying to do simple tasks to see how the code responds.
    I i want to test the performance of ext2/ext3/fat32 by puting a printk in the open() close() read() and write() files so i can count the time and append it in a log file of my own.
    Now does anybody know:

    1)Where is the best place in the code of say open to start and stop the time counting?

    2)How can i recognize the open's and close's that are the result of my script (which performs say 100 open of files and 50 closes) from those that the system does and come form other processes than my own. Any ideas how i can make mine look different in the log file.

    Thnx for any help people

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    First of all, are you really sure that you want to put printks in the open/read/write/close code? That will most probably give you the performance of the VFS code, not ext[23] and vfat.
    If you've really thought it through, the best thing is probably to look at what functions are called with those syscalls, which you can check in arch/i386/entry.S, in the sys_call_table array. Usually, the functions are just named sys_<name>, where <name> is the name of the system call itself. For example write() and called in libc calls syscall 4, which transfers control to the kernel function sys_write. There you can put a printk.
    It's most probably a really bad idea to put printks in read and write, since syslogd will use them to write to the logs, which essantially would make syslogd enter an infinite loop printing out write() logs to your log file.

    To parse the log, write a Perl script (do you want to take that from here, genlee? =) ).
    The best way to distinguish your process from those of the rest of the system is probably to include the PID of the calling process in the printk. Use current->pid. In the same way, you could test current->euid and run your profiling process as a special user in order to avoid syslogd from looping.

    However, think through that you really want to test it this way. It will, as I mentioned, just profile the performance of the VFS subsystem not the filesystem code itself.

    Also, if you really want to do it this way, do you really need to modify the kernel? Can't you just count the opens, closes, etc. in your profiling program?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •