Hi, isn?t this weird: # time foo real 43m39.841s user 15m31.109s sys 0m44.136s Almost 30 minutes have disappeared, but it actually took about that long, so what happened?
On 1 December 2017 at 11:49, hw <hw at gc-24.de> wrote:> > Hi, > > isn?t this weird: > > > # time foo > real 43m39.841s > user 15m31.109s > sys 0m44.136s >This is counting the CPU time that a process used. If something is not in 'CPU' but waiting on input etc it might not get counted in user or sys. There is also the fact that the builtin bash time command you used calculates things differently from the /usr/bin/time command.>From the /usr/bin/time man pageNote: some shells (e.g., bash(1)) have a built-in time command that provides less functionality than the command described here. To access the real command, you may need to specify its pathname (something like /usr/bin/time).>From the bash man pageWhen the shell is in posix mode, time may be followed by a newline. In this case, the shell displays the total user and system time consumed by the shell and its children. The TIMEFORMAT variable may be used to specify the format of the time information. The built in time is actually meant to be used with measuring pipeline information but can be used by itself> > Almost 30 minutes have disappeared, but it actually took about that long, > so what happened? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos-- Stephen J Smoogen.
On 12/01/2017 08:49 AM, hw wrote:> # time foo > real??? 43m39.841s > user??? 15m31.109s > sys???? 0m44.136s > > > Almost 30 minutes have disappeared, but it actually took about that long, > so what happened?I may misunderstand your question, but "time" is provided by the bash shell.? It may be provided by a command if you are using a different shell.? When the command following the "time" keyword completes, bash will print the amount of elapsed time (the amount of time that passed between the command's start and its exit), the amount of time the command was using the CPU and not in a sleep state, and the amount of time the kernel was using the CPU to service requests from the command. So your "foo" application was in a sleep state for around 30 minutes of the 44 minutes that passed between when you started it and when it finished.
Gordon Messmer wrote:> On 12/01/2017 08:49 AM, hw wrote: >> # time foo >> real 43m39.841s >> user 15m31.109s >> sys 0m44.136s >> >> >> Almost 30 minutes have disappeared, but it actually took about that long, >> so what happened? > > > I may misunderstand your question, but > > "time" is provided by the bash shell. It may be provided by a command if you are using a different shell. When the command following the "time" keyword completes, bash will print the amount of elapsed time (the amount of time that passed between the command's start and its exit), the amount of time the command was using the CPU and not in a sleep state, and the amount of time the kernel was using the CPU to service requests from the command. > > So your "foo" application was in a sleep state for around 30 minutes of the 44 minutes that passed between when you started it and when it finished.Hm. Foo is a program that imports data into a database from two CVS files, using a connection for each file and forking to import both files at once. So this would mean that the database (running on a different server) takes almost two times as much as foo --- which I would consider kinda excruciatingly long because it?s merely inserting rows into two different tables after they were prepared by foo and then processes some queries to convert the data. The queries after importing may take like 3 or 5 minutes. About 4.5 million rows are being imported. Would you consider about 20 minutes for importing as long?