///////////////////////////////////////////////////////////////////////////
| 759 | |
| 760 | //////////////////////////////////////////////////////////////////////////////// |
| 761 | int Context::run() { |
| 762 | int rc; |
| 763 | std::string output; |
| 764 | |
| 765 | try { |
| 766 | hooks.onLaunch(); |
| 767 | rc = dispatch(output); |
| 768 | hooks.onExit(); // No chance to update data. |
| 769 | |
| 770 | timer_total.stop(); |
| 771 | time_total_us += timer_total.total_us(); |
| 772 | |
| 773 | std::stringstream s; |
| 774 | s << "Perf " << PACKAGE_STRING << ' ' |
| 775 | #ifdef HAVE_COMMIT |
| 776 | << COMMIT |
| 777 | #else |
| 778 | << '-' |
| 779 | #endif |
| 780 | << ' ' << Datetime().toISO() |
| 781 | |
| 782 | << " init:" << time_init_us << " load:" << time_load_us |
| 783 | << " gc:" << (time_gc_us > 0 ? time_gc_us - time_load_us : time_gc_us) |
| 784 | << " filter:" << time_filter_us << " commit:" << time_commit_us << " sort:" << time_sort_us |
| 785 | << " render:" << time_render_us << " hooks:" << time_hooks_us << " other:" |
| 786 | << time_total_us - time_init_us - time_gc_us - time_filter_us - time_commit_us - |
| 787 | time_sort_us - time_render_us - time_hooks_us |
| 788 | << " total:" << time_total_us << '\n'; |
| 789 | debug(s.str()); |
| 790 | } |
| 791 | |
| 792 | catch (const std::string& message) { |
| 793 | error(message); |
| 794 | rc = 2; |
| 795 | } |
| 796 | |
| 797 | catch (rust::Error& err) { |
| 798 | error(err.what()); |
| 799 | rc = 2; |
| 800 | } |
| 801 | |
| 802 | catch (int) { |
| 803 | // Hooks can terminate processing by throwing integers. |
| 804 | rc = 4; |
| 805 | } |
| 806 | |
| 807 | catch (...) { |
| 808 | error("Unknown error. Please report."); |
| 809 | rc = 3; |
| 810 | } |
| 811 | |
| 812 | // Dump all debug messages, controlled by rc.debug. |
| 813 | if (config.getBoolean("debug")) { |
| 814 | for (auto& d : debugMessages) |
| 815 | if (color()) |
| 816 | std::cerr << colorizeDebug(d) << '\n'; |
| 817 | else |
| 818 | std::cerr << d << '\n'; |
no test coverage detected