LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Really simple terminal question: is there a way to "time" a compression test with 7z? (https://www.linuxquestions.org/questions/linux-newbie-8/really-simple-terminal-question-is-there-a-way-to-time-a-compression-test-with-7z-4175593602/)

d_K 11-15-2016 03:07 PM

Really simple terminal question: is there a way to "time" a compression test with 7z?
 
I'm not looking for anything fancy here, I suppose I could record every output in the bash terminal using a combination of script and tee, but I don't believe that records timestamps of every output? I'm looking for an implementation of this in the future because it would be great to store logs (and timestamps) from the terminal output.

In the meantime, here's what I've come up:

Code:

date && 7z a litecoin-archive .litecoin/ -m0=LZMA2 -mx=7 && date
My understating is that commands will be executed sequentially delimited by "&&" so the above line would record the starting and ending time of a lengthy procedure (especially on a dual-core cpu.) The archive manager in MATE 1.14.1 has no gui method parameter options:mad: so forcing LZMA2 in the terminal is going to produce the best results here (not to mention utilize both cpu cores compared to other compression formats.) And yes, I'm aware LZMA2 is "really only going to be substantial" at 4 or more threads, but I need all the efficiency I can get at -mx=7

Thoughts?

szboardstretcher 11-15-2016 03:09 PM

Quote:

is there a way to "time" a compression test with 7z?
use 'time' before the command to "time" a compression test or any other command:

Code:

time 7z a litecoin-archive .litecoin/ -m0=LZMA2 -mx=7

schneidz 11-15-2016 03:10 PM

not quite following... does time provide the needful ?

d_K 11-15-2016 03:24 PM

Quote:

Originally Posted by szboardstretcher (Post 5630992)
use 'time' before the command to "time" a compression test or any other command:

Code:

time 7z a litecoin-archive .litecoin/ -m0=LZMA2 -mx=7

Ah excellent, thank you. I definitely missed this one in my duckduckgoing:hattip:

szboardstretcher 11-15-2016 03:26 PM

Maybe not. I was answering the question in the title. Not entirely sure what is being asked for. Seems to be two questions?

OP, are you asking for a way to time a command OR log a start/end timestamp for a command?

d_K 11-15-2016 03:29 PM

Quote:

Originally Posted by szboardstretcher (Post 5630999)
Maybe not. I was answering the question in the title. Not entirely sure what is being asked for. Seems to be two questions?

OP, are you asking for a way to time a command OR log a start/end timestamp for a command?

Either or really. I know this is probably going to take an hour+ so I'll be afk for some time and just want to know how long it took when it finishes.

d_K 11-15-2016 03:48 PM

I found a pretty cool article that auto-adds the current date/time to every prompt: https://www.blackmoreops.com/2016/10...erminal-linux/
This would also display the time between prompts.:cool:

chrism01 11-17-2016 09:57 PM

Just fyi, here's 2 ways
Code:

time ls


real        0m0.003s
user        0m0.000s
sys        0m0.002s

\time ls

0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 900maxresident)k
0inputs+0outputs (0major+269minor)pagefaults 0swaps

More info using 2nd version

d_K 11-18-2016 05:56 AM

Btw just a passing curiosity, "time" isn't going to substantially-negatively affect the performance of a cpu benchmark like this right? If the cpu is already being pegged at ~100% on both cores for the duration of the compression test, would tracking "cpu seconds" (user and sys time) use minimal resources?

d_K 11-19-2016 05:30 AM

Yet another thing worth mentioning if anyone's keeping track here, my distro's terminal emulator, "mate-terminal" has a default scrollback of 512 lines. That's an issue if you want to track a non-piped output of a lengthy process (like indeed compressing blockchain app data using 7z) in a default terminal window size because the initial output will get cut off and be lost. In the profile preferences in your terminal, there's an option for "unlimited" scrollback so I've set this from now on. 512 lines seems a bit conservative to me.

Ideally in the future I would be looking around for an emulator that has the ability to log and timestamp every line of output by default (not just on the prompts as my previous link explains. Here's an expounded article on how to export the timestamps on every prompt viewable in "history" by modifying the .bashrc file.)


All times are GMT -5. The time now is 10:44 PM.