How to time file transfers??

Discussion in 'Mac Programming' started by Daniel.eichman, Jan 16, 2010.

  1. Daniel.eichman macrumors newbie

    Jan 16, 2010
    ok i was wondering if any of you know how to time file transfers. I am doing a project which involves "testing" different types of media. EG fire-wire, USB, Ethernet ect. Ok i could time it by hand (stop watch) but that's kinda bad. i was wondering if anyone knows script that get the clock time when the transfer starts and the after it finishes, and displays some time in seconds. i am thinking in terminal but any third party program is fine too thanks.

    thanks :)
  2. chown33 macrumors 604

    Aug 9, 2009
    How are you running the tests? Command-line?

    What kind of timing precision do you need?

    Have you looked at the Disk Activity tab of Activity, located in /Applications/Utilities?

    What have you googled? Try search terms: mac os stopwatch elapsed time

    You can time any command using the 'time' command:

    Example: Time the retrieval of MacRumors home page using 'curl', discarding the received data:
    time curl -s >/dev/null
  3. roadbloc macrumors G3


    Aug 24, 2009
    Any working clock should be able to time that.
  4. Daniel.eichman thread starter macrumors newbie

    Jan 16, 2010
    hey thanks for the reply.
    Basically i am writing this "research" paper in high-school now. My topic has to do with transferring a file over different types of media: USB, fire-wire. So i was going to do some "experiments", and by that i mean send a file (1G?) between two computers using a fire-wire, crossed over Ethernet cable, USB (to Hard drive?) over a set physical distance (1 m). and i am going to time the time is takes to complete the transfer.

    The simple solution is to use Finder and just copy the file, start a physical stopwatch manually and stop the time when the transfer finishes. i was kind of hoping that the timing could be done automatically. using cmd or watvr doesnt matter, i just need to know how to do it.

    Precision? um just 0.1 of a second, its going to take 3-5 min to transfer the file so it doesn't really matter that much.

    it seems to me that the "time" command should do what i want. but i don't know how to use it. So like it can time any command it that is executed in terminal? so if i use terminal to copy the file from X to Y it could time that? and how would i do that?

  5. samwich macrumors regular

    Aug 5, 2007
    When you open terminal it will default to be open in your home directory. To copy a file you simply use the cp command. In terminal you would type

    cp <path-to-file-you-want-copied> <path to destination directory>

    So if I had a text file name text.txt in my home directory and wanted to copy it to my Documents folder, I would open terminal and type

    cp text.txt Documents

    You can time it by saying

    time cp text.txt Documents

    Check this out for more info
  6. chown33 macrumors 604

    Aug 9, 2009
    Have you tried anything at all?

    I suggest starting with a reality check. Use a stopwatch (or just a wall clock), and measure how long Finder takes to copy a 1 GB file over ethernet. It should be easy to get 1-second precision. 3-5 minutes for 1 GB seems unlikely to me.
  7. Daniel.eichman thread starter macrumors newbie

    Jan 16, 2010
    thanks guys i think that should work.
    @ chown i am a HS student so dont hate and u could totally get 1g in 3-5min over fire-wire USB and a crossed over Ethernet cable(no router)
    but thanks again to both of you
  8. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    What are you really wanting to test here? The speed of the physical media? (9-pin FireWire,A-to-A USB,Category 5 Ethernet) If so, the same physical media can be used for different protocols (100Mbit vs 1Gbit Ethernet, USB 1.2 vs. USB 2.0, etc.). So are you really testing a protocol? For FireWire are you going to test using target disk mode (ATA over FireWire) or set this up via IP over FireWire? The overhead is quite different. Also, if your goal is to test the physical media or protocol, there's going to be a lot in your way. You will have a lot of software and other hardware in the way. The driver for the interface in question, the protocol implementation, the TCP/IP stack, how much RAM is available and what speed it's operating at, the filesystems in use on the disks, in the case of USB the CPU speed and load on the machines, the speed of the harddrives and the interfaces on both machines (and which way you go, reading tends to be faster than writing). You're really going to be testing all of these at once. This really detracts from the rigor of your study. It sounds like you haven't started testing, so maybe it's not too late to change the subject of your paper.

    It has been mentioned above, but I would say terminal + cp + time should get you a decent result, then you just divide the total bytes by total seconds to vet bytes/sec.
    time cp /disk1/fileA /disk2/

    Also, don't use "I'm in high school" as an excuse. You will very soon be an adult, time to practice acting like and being treated like one. You shouldn't expect people's responses or treatment of you or your problem to vary based on your current academic status.

  9. chown33 macrumors 604

    Aug 9, 2009
    That's not hating. That's just asking if you've done your homework yet.

    My point about 3-5 min is that it's too long, which suggested to me that you hadn't actually done anything yet, but came here expecting a handout. You may be shocked, but it does happen.
  10. Daniel.eichman thread starter macrumors newbie

    Jan 16, 2010
    yeah i haven't done any testing yet i was really just asking for syntax in terminal. But thanks for the tips, i thought about most of that.(not the fire-wire IP) but i think i wont test that cause i will need a router i think the less hardware involved the better(less variables). i am probably going to borrow two white mac's from our school that way i can eliminate all most all of those variables, and write form one to the other.(for USB ill take the HD out, unless i can firgue out write form one to the other via USB) Are u sure cat5 cable goes up to 1Gbps? thought is was just 100mbps, but not sure on that and it doesn't really matter. As for a handout, i have to write a 4000 word essay not including graphs references and test data. i kinda doubt anyone word hand that out.
    but thanks again for the syntax and tips
  11. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    What chown33 meant by "handout" was in reference to people coming here asking for us to do their job or homework for them.

    Gigabit ethernet has been around for about 10 years, and cat 5 is the minimum physical media, with cat 5e and cat 6 being options as well.

    IP-over-FireWire doesn't require a router. Just a 6-pin or 9-pin cable between the machines, just like target disk mode.

    Out of curiosity, do you think that your results will vary from tests that have been done thousands of times already? Normally a reasearch paper is about seeking out sources, accumulating data, properly referencing your sources, and drawing a conclusion based on this research. Normally you don't run experiments yourself (that have been done ad infinitum by others already). I don't know how you'll extend the comparison of performance of 3 items in a single configuration to 4000 words. I don't mean to discourage you, this just strikes me as very odd.

  12. chown33 macrumors 604

    Aug 9, 2009

Share This Page