Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Gurus, I am using a svn checkout to checkout a full repository in one of my scripts for testing performance issues. I would like to know the number of files checked out and there file type whether its a jar or text .... and the average time it took to checkout each file from SVN repository with size and time. And also the data transferred in kb/sec while checking out. Is there a way I can get this done. Thanks, Pete

Replies are listed 'Best First'.
Re: Perl Data Transfer Rate
by Fletch (Bishop) on Nov 14, 2008 at 21:24 UTC

    Wild fuzzy handwaving offering of direction follows . . .

    You're probably not going to get really accurate times as the SVN client itself doesn't provide that information. You might could use Expect or IPC::Run to open a pty which is reading from your svn co URL process and use Time::HiRes to note duration between when lines for each file are emitted (you'd want to make sure it's on a pty so that its STDOUT hopefully doesn't go into buffered mode). After the checkout is done you'd go back and compute the rate by looking at the final size of the file (but keep in mind that SVN keeps another copy of the current revision's contents stashed locally so there's probably some extra time for the local copying embedded in those values).

    If that's not precise enough you might want to look at the swig interface to the underlying SVN API; however I don't know if you wouldn't wind up rewriting most of svn co in order to get things instrumented at the right places to get the numbers in which you're interested. Not to mention the SVN API's kinda hairy at the lower levels . . .

    Also something like File::Magic could be of interest in determining what kind of contents files have.

    Update: Tweaked second paragraph.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: Perl Data Transfer Rate
by ikegami (Patriarch) on Nov 14, 2008 at 21:21 UTC
    Are you expecting us to write your application for you, or do you have a question?
      I have a script testing the performance and one of the requirement is to know the data transfer in the svn checkout command. I have a question how can I get it using perl. benchmark gives only the time it takes between the command start and command end. timethis was also not useful to me. I am looking for suggestions so I can improve my script.
        Transfer rate is the time it took to perform the transfer — the difference between the results of two calls to time — divided by amount of data transfered. Using time from Time::HiRes will provide greater accuracy.
Re: Perl Data Transfer Rate
by Joost (Canon) on Nov 14, 2008 at 23:10 UTC
      I haven't used SVN much but if it is anything like ClearCase then the larger the file is, the longer the checkout takes. I have a file that is roughly 1.5G and it takes between 20 and 30 minutes to check it out with ClearCase. :(
Re: Perl Data Transfer Rate
by BrowserUk (Patriarch) on Nov 14, 2008 at 22:43 UTC

    Perhaps the simplest method would be to set up a custom proxy and modify your subversion configuration to go through that. You could then log whatever information to whatever accuracy you need.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Perl Data Transfer Rate
by salva (Canon) on Nov 14, 2008 at 21:53 UTC
    if you are using HTTP as the transfer layer for Subversion, the logs from the web server may contain all the information you need: timestamp, url and the amount of data transferred in each request.