| 110 | } |
| 111 | |
| 112 | void Application::log(int verbose, const std::string& str) |
| 113 | { |
| 114 | if (verbosity < verbose) |
| 115 | return; |
| 116 | |
| 117 | double time = getSeconds(); |
| 118 | ssize_t virtual_memory = getVirtualMemoryBytes(); |
| 119 | ssize_t resident_memory = getResidentMemoryBytes(); |
| 120 | |
| 121 | double log_time = log_delta ? time-last_time : time-start_time; |
| 122 | ssize_t log_virtual_memory = log_delta ? virtual_memory-last_virtual_memory : virtual_memory; |
| 123 | ssize_t log_resident_memory = log_delta ? resident_memory-last_resident_memory : resident_memory; |
| 124 | |
| 125 | std::cout << "[ " |
| 126 | << std::setw(8) << std::setprecision(3) << std::fixed << log_time << "s, " |
| 127 | << std::setw(8) << std::setprecision(2) << std::fixed << double(log_virtual_memory)/1E6 << " MB virtual, " |
| 128 | << std::setw(8) << std::setprecision(2) << std::fixed << double(log_resident_memory)/1E6 << " MB resident ] " |
| 129 | << str << std::fixed |
| 130 | << std::endl << std::flush; |
| 131 | |
| 132 | last_time = time; |
| 133 | last_virtual_memory = virtual_memory; |
| 134 | last_resident_memory = resident_memory; |
| 135 | } |
| 136 | |
| 137 | void CommandLineParser::registerOptionAlias(const std::string& name, const std::string& alternativeName) { |
| 138 | commandLineOptionMap[alternativeName] = commandLineOptionMap[name]; |
no test coverage detected