Changeset 19100 for trunk/FACT++
- Timestamp:
- 07/30/18 23:01:03 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/rootifysql.cc
r19096 r19100 38 38 ("no-fill", po_switch(), "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)") 39 39 ("delimiter", var<string>(""), "The delimiter used if contents are displayed with --display (default=\\t)") 40 ("explain", po_switch(), "Requests an EXPLAIN from the server (shows the server optimized query)")40 ("explain", po_switch(), "Requests an EXPLAIN from the server (shows the server optimized query)\nsee also https://dev.mysql.com/doc/refman/explain-output.html") 41 41 ("profiling", po_switch(), "Turn on profiling and print profile") 42 42 ("var.*", var<string>(), "Predefined SQL user variables (@VAR)") … … 391 391 392 392 if (verbose>0) 393 cout << "\n--------------------- Rootify SQL----------------------" << endl;393 cout << "\n------------------------ Rootify SQL -------------------------" << endl; 394 394 395 395 string query = conf.Get<string>("query"); … … 800 800 cout << "File closed.\n"; 801 801 cout << "Execution time: " << Time().UnixTime()-start.UnixTime() << "s\n"; 802 cout << "--------------------------------------------------------" << endl; 802 cout << "--------------------------------------------------------------" << endl; 803 804 try 805 { 806 const auto resw = 807 connection.query("SHOW WARNINGS").store(); 808 809 if (resw.num_rows()>0) 810 cout << "\nWARNINGS:\n\n"; 811 812 for (size_t i=0; i<resw.num_rows(); i++) 813 { 814 const mysqlpp::Row &roww = resw[i]; 815 816 cout << roww["Level"] << '[' << roww["Code"] << "]: "; 817 cout << roww["Message"] << '\n' << endl; 818 } 819 820 } 821 catch (const exception &e) 822 { 823 cerr << "\nSHOW WARNINGS\n\n"; 824 cerr << "SQL query failed:\n" << e.what() << endl; 825 return 6; 826 } 803 827 } 804 828 … … 807 831 try 808 832 { 833 const auto N = 834 connection.query("SHOW PROFILES").store().num_rows(); 835 809 836 const auto resp = 810 connection.query("SHOW PROFILE ALL ").store();837 connection.query("SHOW PROFILE ALL FOR QUERY "+to_string(verbose?N-1:N)).store(); 811 838 812 839 cout << '\n'; 813 840 cout << left; 814 cout << setw(2 0) << "Status" << ' ';841 cout << setw(26) << "Status" << ' '; 815 842 cout << right; 816 843 cout << setw(11) << "Duration" << ' '; 817 844 cout << setw(11) << "CPU User" << ' '; 818 845 cout << setw(11) << "CPU System" << '\n'; 819 cout << "-------------------------------------------------------- \n";846 cout << "--------------------------------------------------------------\n"; 820 847 for (size_t i=0; i<resp.num_rows(); i++) 821 848 { … … 823 850 824 851 cout << left; 825 cout << setw(2 0) << rowp["Status"] << ' ';852 cout << setw(26) << rowp["Status"] << ' '; 826 853 cout << right; 827 854 cout << setw(11) << rowp["Duration"] << ' '; … … 829 856 cout << setw(11) << rowp["CPU_system"] << '\n'; 830 857 } 831 cout << "-------------------------------------------------------- \n";858 cout << "--------------------------------------------------------------\n"; 832 859 cout << endl; 833 860 }
Note:
See TracChangeset
for help on using the changeset viewer.