Пример #1
0
fractional_progress::~fractional_progress() {
#ifndef TPIE_NDEBUG
    if (m_init_called && !m_done_called && !std::uncaught_exception()) {
        std::stringstream s;
        s << "A fractional_progress was destructed without done being called." << std::endl;
        TP_LOG_FATAL(s.str());
        s.str("Subindicators were:\n");
        s << sub_indicators_ss();
        tpie::backtrace(s, 5);
        TP_LOG_DEBUG(s.str());
        TP_LOG_FLUSH_LOG;
    }
#endif
    if (fdb->capture) {
        time_type time_sum=0;
        for (size_t i=0; i < m_stat.size(); ++i)
            time_sum += m_stat[i].second.first;

        if (time_sum > 0) {
            for (size_t i=0; i < m_stat.size(); ++i) {
                std::pair< std::string, std::pair<time_type, stream_size_type> > & x = m_stat[i];
                float f= (float)x.second.first / (float)time_sum;
                fdb->update(x.first.c_str(), f, x.second.second);
            }
        }
    }
}
progress_indicator_subindicator::~progress_indicator_subindicator() {
	if (m_init_called && !m_done_called && !std::uncaught_exception()) {
		std::stringstream s;
		s << "A progress_indicator_subindicator was destructed without done being called." << std::endl;
		TP_LOG_FATAL(s.str());
		s.str("");
		tpie::backtrace(s, 5);
		TP_LOG_DEBUG(s.str());
		TP_LOG_FLUSH_LOG;
	}
}
Пример #3
0
void fractional_progress::init(stream_size_type range) {
    unused(range);
#ifndef TPIE_NDEBUG
    if (m_init_called) {
        std::stringstream s;
        s << "init() was called on a fractional_progress for which init had already been called.  Subindicators were:" << std::endl;
        s << sub_indicators_ss();
        TP_LOG_FATAL(s.str());
        s.str("");
        tpie::backtrace(s, 5);
        TP_LOG_DEBUG(s.str());
        TP_LOG_FLUSH_LOG;
    }
    m_init_called=true;
#endif
    if (m_pi) m_pi->init(23000);
}
Пример #4
0
fractional_subindicator::~fractional_subindicator() {
#ifndef TPIE_NDEBUG
    if (!m_init_called && m_fraction > 0.00001 && !std::uncaught_exception()) {
        std::stringstream s;
        if (!m_stat.empty()) {
            s << "A fractional_subindicator for ``" << m_stat << "'' was assigned a non-zero fraction but never initialized." << std::endl;
        } else {
            s << "A fractional_subindicator was assigned a non-zero fraction but never initialized." << std::endl;
        }
        TP_LOG_FATAL(s.str());
        s.str("");
        tpie::backtrace(s, 5);
        TP_LOG_DEBUG(s.str());
        TP_LOG_FLUSH_LOG;
    }
#endif
}
Пример #5
0
void fractional_progress::done() {
#ifndef TPIE_NDEBUG
    if (m_done_called || !m_init_called) {
        std::stringstream s;
        if (m_done_called) {
            s << "done() was called on fractional_progress, but done has already been called.  Subindicators were:" << std::endl;
        } else {
            s << "done() was called on fractional_progress, but init has not been called.  Subindicators were:" << std::endl;
        }
        s << sub_indicators_ss();
        TP_LOG_FATAL(s.str());
        s.str("");
        tpie::backtrace(s, 5);
        TP_LOG_DEBUG(s.str());
        TP_LOG_FLUSH_LOG;
    }
    m_done_called=true;
#endif
    if (m_pi) m_pi->done();
}