diff options
author | Roman Pogribnyi <pogribnyi@gmail.com> | 2015-03-15 21:57:06 +0300 |
---|---|---|
committer | Roman Pogribnyi <pogribnyi@gmail.com> | 2015-03-15 21:57:06 +0300 |
commit | 5c64aa25541b973db4ec90c97e30b02d09b00075 (patch) | |
tree | 0cd3a8912d8b0cbfc5fe0bb94a2a42751e98dcd6 /intern/cycles/app/cycles_standalone.cpp | |
parent | 2a1a6bc5720a4310e42a67754998e0480bf7c59b (diff) | |
parent | 225027ce5dea3785626908b58b01fb3959cf8362 (diff) |
Merge branch 'master' into soc-2014-fluid
Diffstat (limited to 'intern/cycles/app/cycles_standalone.cpp')
-rw-r--r-- | intern/cycles/app/cycles_standalone.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp index 90333eb3fc5..42c339f56e5 100644 --- a/intern/cycles/app/cycles_standalone.cpp +++ b/intern/cycles/app/cycles_standalone.cpp @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License + * limitations under the License. */ #include <stdio.h> @@ -25,6 +25,7 @@ #include "util_args.h" #include "util_foreach.h" #include "util_function.h" +#include "util_logging.h" #include "util_path.h" #include "util_progress.h" #include "util_string.h" @@ -70,12 +71,12 @@ static void session_print(const string& str) static void session_print_status() { int sample, tile; - double total_time, sample_time; + double total_time, sample_time, render_time; string status, substatus; /* get status */ sample = options.session->progress.get_sample(); - options.session->progress.get_tile(tile, total_time, sample_time); + options.session->progress.get_tile(tile, total_time, sample_time, render_time); options.session->progress.get_status(status, substatus); if(substatus != "") @@ -165,11 +166,11 @@ static void display_info(Progress& progress) last = elapsed; int sample, tile; - double total_time, sample_time; + double total_time, sample_time, render_time; string status, substatus; sample = progress.get_sample(); - progress.get_tile(tile, total_time, sample_time); + progress.get_tile(tile, total_time, sample_time, render_time); progress.get_status(status, substatus); if(substatus != "") @@ -319,6 +320,11 @@ static void options_parse(int argc, const char **argv) vector<DeviceType>& types = Device::available_types(); + /* TODO(sergey): Here's a feedback loop happens: on the one hand we want + * the device list to be printed in help message, on the other hand logging + * is not initialized yet so we wouldn't have debug log happening in the + * device initialization. + */ foreach(DeviceType type, types) { if(device_names != "") device_names += ", "; @@ -331,7 +337,8 @@ static void options_parse(int argc, const char **argv) /* parse options */ ArgParse ap; - bool help = false; + bool help = false, debug = false; + int verbosity = 1; ap.options ("Usage: cycles [options] file.xml", "%*", files_parse, "", @@ -347,6 +354,10 @@ static void options_parse(int argc, const char **argv) "--width %d", &options.width, "Window width in pixel", "--height %d", &options.height, "Window height in pixel", "--list-devices", &list, "List information about all available devices", +#ifdef WITH_CYCLES_LOGGING + "--debug", &debug, "Enable debug logging", + "--verbose %d", &verbosity, "Set verbosity of the logger", +#endif "--help", &help, "Print help message", NULL); @@ -355,7 +366,13 @@ static void options_parse(int argc, const char **argv) ap.usage(); exit(EXIT_FAILURE); } - else if(list) { + + if (debug) { + util_logging_start(); + util_logging_verbosity_set(verbosity); + } + + if(list) { vector<DeviceInfo>& devices = Device::available_devices(); printf("Devices:\n"); @@ -435,6 +452,7 @@ using namespace ccl; int main(int argc, const char **argv) { + util_logging_init(argv[0]); path_init(); options_parse(argc, argv); |