Changeset 19136


Ignore:
Timestamp:
08/03/18 20:53:39 (6 years ago)
Author:
tbretz
Message:
Output some more connection information with print-connect
Location:
trunk/FACT++/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/calcsource.cc

    r19125 r19136  
    33#include "pal.h"
    44#include "nova.h"
     5#include "tools.h"
    56#include "Time.h"
    67#include "Configuration.h"
  • trunk/FACT++/src/fits2sql.cc

    r19135 r19136  
    464464    Database connection(uri);
    465465
     466    if (verbose>0)
     467    {
     468        cout << "Client Version: " << connection.client_version() << '\n';
     469        cout << "Server Version: " << connection.server_version() << endl;
     470    }
     471
    466472    if (print_connection)
    467473    {
     
    692698    }
    693699
     700    if (print_connection)
     701    {
     702        try
     703        {
     704            const auto &res1 = connection.query("SHOW STATUS LIKE 'Bytes_%'").store();
     705            cout << left << setw(16) << res1[0]["Variable_name"] << ' ' << Tools::Scientific(res1[0]["Value"]) << endl;
     706            cout << left << setw(16) << res1[1]["Variable_name"] << ' ' << Tools::Scientific(res1[1]["Value"]) << endl;
     707            cout << endl;
     708        }
     709        catch (const exception &e)
     710        {
     711            cerr << "\nSHOW STATUS LIKE 'Bytes_%'\n\n";
     712            cerr << "SQL query failed:\n" << e.what() << endl;
     713            return 6;
     714        }
     715    }
     716
    694717    return 0;
    695718}
  • trunk/FACT++/src/root2sql.cc

    r19135 r19136  
    483483    }
    484484
     485    if (verbose>0)
     486    {
     487        cout << "Client Version: " << connection.client_version() << '\n';
     488        cout << "Server Version: " << connection.server_version() << endl;
     489    }
     490
    485491    if (print_connection)
    486492    {
     
    680686    }
    681687
     688    if (print_connection)
     689    {
     690        try
     691        {
     692            const auto &res1 = connection.query("SHOW STATUS LIKE 'Bytes_%'").store();
     693            cout << left << setw(16) << res1[0]["Variable_name"] << ' ' << Tools::Scientific(res1[0]["Value"]) << endl;
     694            cout << left << setw(16) << res1[1]["Variable_name"] << ' ' << Tools::Scientific(res1[1]["Value"]) << endl;
     695            cout << endl;
     696        }
     697        catch (const exception &e)
     698        {
     699            cerr << "\nSHOW STATUS LIKE 'Bytes_%'\n\n";
     700            cerr << "SQL query failed:\n" << e.what() << endl;
     701            return 6;
     702        }
     703    }
     704
    682705    return 0;
    683706}
  • trunk/FACT++/src/rootifysql.cc

    r19134 r19136  
    3535        ("ignore",        vars<string>(),              "Ignore the given columns")
    3636        ("display,d",     po_switch(),                 "Displays contents on the screen (most usefull in combination with mysql statements as SHOW or EXPLAIN)")
    37         ("write",         var<string>(""),             "Write output to an ascii file")
     37        ("write,w",       var<string>(""),             "Write output to an ascii file")
    3838        ("null,n",        po_switch(),                 "Redirect the output file to /dev/null (mainly for debugging purposes, e.g. performance studies)")
    3939        ("no-fill",       po_switch(),                 "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)")
     
    446446            if (!l.empty() && l[0]!='#')
    447447                envs[ident].push_back(line);
     448        }
    448449
    449450        if (verbose>0)
     
    499500    Database connection(uri); // Keep alive while fetching rows
    500501
     502    if (verbose>0)
     503    {
     504        cout << "Client Version: " << connection.client_version() << '\n';
     505        cout << "Server Version: " << connection.server_version() << endl;
     506    }
     507
    501508    if (print_connection)
    502509    {
     
    511518        catch (const exception &e)
    512519        {
    513             cerr << "\nSHOW STATUS LIKE COMPRESSION\n\n";
     520            cerr << "\nSHOW STATUS LIKE 'Compression'\n\n";
    514521            cerr << "SQL query failed:\n" << e.what() << endl;
    515522            return 6;
     
    650657
    651658    if (verbose>0)
    652         cout << "Opening file '" << path << "' [compression=" << compression << "]..." << endl;
     659    {
     660        cout << "Opening file '" << path << "' [compression=" << compression << "]...\n";
     661        cout << "Writing data to tree '" << tree << "'" << endl;
     662    }
    653663
    654664    // ----------------------------- Open output file --------------------------
     
    931941    }
    932942
     943    if (print_connection)
     944    {
     945        try
     946        {
     947            const auto &res1 = connection.query("SHOW STATUS LIKE 'Bytes_%'").store();
     948            cout << left << setw(16) << res1[0]["Variable_name"] << ' ' << Tools::Scientific(res1[0]["Value"]) << endl;
     949            cout << left << setw(16) << res1[1]["Variable_name"] << ' ' << Tools::Scientific(res1[1]["Value"]) << endl;
     950            cout << endl;
     951        }
     952        catch (const exception &e)
     953        {
     954            cerr << "\nSHOW STATUS LIKE 'Bytes_%'\n\n";
     955            cerr << "SQL query failed:\n" << e.what() << endl;
     956            return 6;
     957        }
     958    }
     959
    933960    return 0;
    934961}
Note: See TracChangeset for help on using the changeset viewer.