LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2016, 04:07 PM   #1
d_K
LQ Newbie
 
Registered: Aug 2016
Posts: 10

Rep: Reputation: Disabled
Question 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 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?
 
Old 11-15-2016, 04:09 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,774
Blog Entries: 1

Rep: Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339
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

Last edited by szboardstretcher; 11-15-2016 at 04:14 PM.
 
2 members found this post helpful.
Old 11-15-2016, 04:10 PM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,026

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
not quite following... does time provide the needful ?
 
Old 11-15-2016, 04:24 PM   #4
d_K
LQ Newbie
 
Registered: Aug 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
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
 
Old 11-15-2016, 04:26 PM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,774
Blog Entries: 1

Rep: Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339
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?
 
Old 11-15-2016, 04:29 PM   #6
d_K
LQ Newbie
 
Registered: Aug 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
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.
 
Old 11-15-2016, 04:48 PM   #7
d_K
LQ Newbie
 
Registered: Aug 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
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.
 
Old 11-17-2016, 10:57 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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
 
1 members found this post helpful.
Old 11-18-2016, 06:56 AM   #9
d_K
LQ Newbie
 
Registered: Aug 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
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?
 
Old 11-19-2016, 06:30 AM   #10
d_K
LQ Newbie
 
Registered: Aug 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
Exclamation

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.)
 
  


Reply

Tags
7zip, compression, multithreading, smp, timer


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Script Needed to Calculate How Many "15" Minutes are in a Time Stamp deepGC Linux - Newbie 8 05-30-2015 03:14 PM
Using "normal", vs "low-latency" vs "real-time RT" kernels GTrax Linux - Software 7 07-10-2014 05:34 AM
Why there is a "command not found" prompt every time I open the Terminal? cricketlong Linux - General 14 04-28-2012 04:14 AM
[SOLVED] "Insert" & "Delete" key returns "~" in a terminal. sharky Linux - General 15 04-26-2011 09:36 AM
How to write a simple BASH script to "test if have folowing files, than delete."? hocheetiong Programming 10 10-01-2009 01:17 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration