Summary: | tcsh: builtin time variable not respected | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | kalium |
Component: | Current packages | Assignee: | Fabian Groffen <grobian> |
Status: | RESOLVED NEEDINFO | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
kalium
2005-12-07 06:21:34 UTC
not sure. I tested what you give on tcsh 6.14 in portage, and on Fedora Core. Both don't seem to do anything with the time variable. 6.11 on Debian (I guess that version is 'stable') doesn't also respect this variable. Do you know a system/setting where it does work? it's unknown if this should work. (In reply to comment #2) > it's unknown if this should work. > To set a variable in tcsh with multiple words, the syntax is: set time = ( 3 %M ) or if the second word (which is the format for the time command) has a space: set time = ( 3 '%M %E' ) "If set to a number, then the time builtin (q.v.) executes automatically after each command which takes more than that many CPU seconds. If there is a second word, it is used as a format string for the output of the time builtin." For a program to use more than 3 CPU seconds (not wall clock runtime) as your time variable requests, it has to do some serious number crunching: #include <iostream> #include <math.h> int main() { for(long i = 0L ; i < 1e9 ; ++i) { double x = sqrt(2.0); if ( i % 1000 == 0 ) std::cout << i << " " << x << std::endl; } return 0; } If it does take more than 3 seconds and you set the time variable with the proper syntax you should see an extra line of output in the shell when the program terminates. |