Exemplo n.º 1
0
/**\brief Collect into a virtual-table row the information about this thread
 * \details
 * The row attributes are described in \code "sthread_vtable_enum.h" \endcode.
 * The attributes are:
 * Thread id
 * Thread name
 * Thread status
 * + all the attributes generated by the stats Perl tool.
 */
void        
sthread_t::vtable_collect(vtable_row_t& t)  // argument MUST be named "t"
{
    /* Convert sthread info to strings: */

    t.set_int(sthread_id_attr, id);
    t.set_string(sthread_name_attr, name() );
    t.set_string(sthread_status_attr,  sthread_t::status_strings[status()]);

/* define TMP_GET_STAT to the get-stat macro for sthreads: */
#define TMP_GET_STAT(x) SthreadStats.x
#include "sthread_stats_collect_gen.cpp"
}
Exemplo n.º 2
0
void        
xct_t::vtable_collect(vtable_row_t &t)
{
    // xct_nthreads_attr
    t.set_int(xct_nthreads_attr, num_threads());

    // xct_gtid_attr
    if(is_extern2pc()) {
        w_ostrstream        s;
        s << *gtid() << ends;
        t.set_string(xct_gtid_attr, s.c_str());
    } else {
        t.set_string(xct_gtid_attr, "");
    }
    // xct_tid_attr
    {
        w_ostrstream o;
        o << tid() << ends;
        t.set_string(xct_tid_attr, o.c_str());
    }

    // xct_state_attr
    {
        w_ostrstream o;
        o << state() << ends;
        t.set_string(xct_state_attr, o.c_str());
    }

    // xct_coordinator_attr
    if(state() == xct_prepared) {
        w_ostrstream        s;
        s << get_coordinator() << ends;
        t.set_string(xct_coordinator_attr, s.c_str());
    } else {
        t.set_string(xct_coordinator_attr, "");
    }

    // xct_forced_readonly_attr
    t.set_string(xct_forced_readonly_attr, 
            (forced_readonly()?"true":"false"));
}