0

I have a program that reads in a long list of words from a text file with command line redirection. No file streams.

It takes the data in using getline(cin, string) and reads it into a vector. My program then processes the data. It also uses dynamic memory (not sure if this fact is relevant).

Why am I getting this error:

Warning: Your program used more system time (0.001 sec) than user time (0.000 sec).
    This may be due to excessive I/O, overly frequent time measurement
    (via getrusage for example), or unnecessary system calls.
Will
  • 24,082
  • 14
  • 97
  • 108
Ben C.
  • 31
  • 4
  • 3
    Do you know where the warning's coming from? Some kind of profiler maybe? I've never seen that before. – user253751 Jan 27 '16 at 02:27
  • In fact, Google returns *zero results* for `"Warning: Your program used more system time"` – user253751 Jan 27 '16 at 02:28
  • Regarding system and user time you can read [this question](http://stackoverflow.com/q/556405/3959454) – Anton Savin Jan 27 '16 at 02:29
  • Are you running this in some sort of sandbox, "online judge" environment, or from an IDE? – paddy Jan 27 '16 at 02:31
  • 2
    Question title is wrong. The program **doesn't** use more system time than run time. The message contrasts system time with **user** time. What you call an *error* is tagged as a *warning*, too. I have no idea, who issues that warning, and you keep details about the environment private. Not a good question in all. – IInspectable Jan 27 '16 at 02:31

1 Answers1

1

Your code is reading and writing files, which results in open(), read(), and write() system calls among others. "User" and "System" time are CPU time spent in userspace and system/kernelspace, respectively. The kernel can also make use of multiple CPUs, so having far higher "CPU time" than "real time" isn't anything weird.

No idea what profiling tool you're running to tell you that, as Google comes up with nothing, but, the tool is wrong. There is no problem here.

Will
  • 24,082
  • 14
  • 97
  • 108