コード例 #1
0
void CHislogStream::_debugDump(int n)
{
    hislog_value_list::iterator it;
    hislog_item_t * v;

    it = m_values.begin();
    if(n == -1) {
        while(it != m_values.end()) {
            v = &it->second;
            printf(
                "%s [0x%I64x] -- %s\n",
                timeAsString(it->first).c_str(),
                it->first,
                valueAsString(&it->second).c_str()
            );
            it++;
        }
        putchar('\n');
    } else {
        if(n < 0 || n > m_values.size()) {
            return;
        }
        while(n--) {
            it++;
        }
    }
}
コード例 #2
0
void CInMemoryBuffer::stopRecord(hislog_key_t now)
{
	__uint size;
	hislog_stream_list::iterator it;

#if 1
	{
		DEBUG_PRINTF((
			"Recording stopped on %s\n",
			timeAsString(now).c_str()
			));
	}
#endif

	//utils_debug("wlock 2\n");
	WriteLock();
	
	if(m_state != bs_logging){
		//utils_debug("release 3\n");
		Release();
		throw(m_state);
	}
	
	if(!lock_rtdb(__false, 100)){
		//utils_debug("release 4\n");
		Release();
		return;
	}
	
	for(size = m_streams.size(), it = m_streams.begin(); size; it++, size--){
		it->second->putSnapshot(now, NULL, __true);
	}

	m_state = bs_ready;
	
	unlock_rtdb();

	//utils_debug("release 5\n");
	Release();
}
コード例 #3
0
ファイル: timer.hpp プロジェクト: GrossfieldLab/loos
 std::ostream& operator<<(std::ostream& os, const Timer<T>& t) {
   std::string s = timeAsString(t.elapsed());
   os << "Elapsed time " << s;
   return(os);
 }
コード例 #4
0
ファイル: timetracker.hpp プロジェクト: hoytak/latticeflow
inline std::string TimeTracker::asString() const
{
  return timeAsString(elapsedSeconds());
}
コード例 #5
0
void CInMemoryBuffer::startRecord(hislog_key_t now)
{
	SYSTEMTIME st;
	FILETIME ft;
	char buf[_MAX_PATH];
	hislog_stream_list::iterator it, next;
	CHislogStream * str;
	
	//utils_debug("wlock 1\n");
	WriteLock();
	
	if(m_state != bs_ready){
		//utils_debug("release 1\n");
		Release();
		throw(m_state);
	}

	ft = getTimeByKey(now);
	FileTimeToSystemTime(&ft, &st);
	_snprintf(
		buf,
		sizeof(buf),
		"%svar/hisd/%04d-%02d-%02d", 
		get_working_dir(),
		st.wYear,
		st.wMonth,
		st.wDay
		);
	m_pathName = buf;
	
	_snprintf(
		buf,
		sizeof(buf),
		"%svar/hisd/%04d-%02d-%02d/%02d-%02d-%02d.hsd", 
		get_working_dir(),
		st.wYear,
		st.wMonth,
		st.wDay,
		st.wHour,
		st.wMinute,
		st.wSecond
		);
	m_fileName = buf;
#if 1
	{
		DEBUG_PRINTF((
			"Recording started on %s\n",
			timeAsString(now).c_str()
			));
	}
#endif

	m_startTime = now;
	m_endTime = now;

	// handle postponed deletion
	it = m_streams.begin();
	while(it != m_streams.end()){
		next = it;
		next++;
		str = it->second;
		if(str->m_deletePending){
			delete str;
			m_streams.erase(it);
		}else{
			str->clear();
		}
		it = next;
	}
	
	m_state = bs_logging;
	
	//utils_debug("release 2\n");
	Release();
}