Esempio n. 1
0
static void void_sink_process(MSFilter *f){
	mblk_t *im;
	while((im=ms_queue_get(f->inputs[0]))!=NULL){
		dump2file(im);
		freemsg(im);
	}
}
Esempio n. 2
0
static const char *interpreter_error_result(lua_State *L) {
	// There's an error on top of the stack
	if (lua_istable(L, -1)) {
		lua_getfield(L, -1, "trace");
		const char *trace = lua_tostring(L, -1);
		if (trace) {
			TRACE("%s", trace);
			if (!dump2file(crash_file, trace))
				WARN("Crash report of stack trace dump failed.");
		} // Else just print message, we are probably missing trace
		lua_pop(L, 1);
		lua_getfield(L, -1, "msg");
	}
	const char *errmsg = lua_tostring(L, -1);
	return errmsg;
}
Esempio n. 3
0
int PropertyImp::handlePropMsg(const map<StatPropMsgHead, StatPropMsgBody> &propMsg, tars::TarsCurrentPtr current)
{
    for ( map<StatPropMsgHead,StatPropMsgBody>::const_iterator it = propMsg.begin(); it != propMsg.end(); it++ )
    {

        const StatPropMsgHead &head = it->first;
        const StatPropMsgBody &body = it->second;

        PropHead tHead;
        tHead.moduleName    = head.moduleName;
        tHead.propertyName  = head.propertyName;
        tHead.setName       = head.setName;
        tHead.setArea       = head.setArea;
        tHead.setID         = head.setID;
        tHead.ip            = current->getIp();

        size_t iIndex = 0;
        PropertyImpThreadData * td = PropertyImpThreadData::getData();

        if(td)
        {
            iIndex = td->_threadIndex;
        }

        dump2file();

        int iBufferIndex = g_app.getSelectBufferIndex();

        if(_lastBufferIndex != iBufferIndex)
        {
            if(_lastBufferIndex != -1)
            {
                TLOGDEBUG("PropertyImp::handlePropMsg iIndex:" << iIndex << "|iBufferIndex:" << iBufferIndex << "|_lastBufferIndex:" << _lastBufferIndex << endl);

                map<int,vector<pair<int64_t, int> > >& mBuffer = g_app.getBuffer();
                map<int,vector<pair<int64_t, int> > >::iterator iter = mBuffer.find(_lastBufferIndex);
                iter->second[iIndex].first  = TNOWMS;
                iter->second[iIndex].second = 1;
            }

            _lastBufferIndex = iBufferIndex;
        }

        string sKey = tHead.moduleName;
        sKey += tHead.ip;

        int iHashKey = _hashf(sKey) % g_app.getBuffNum();

        PropertyHashMap *pHashMap = g_app.getHashMapBuff(iBufferIndex, iHashKey);
        
        //////////////////////////////////////////////////////////////////////////////////////

        float rate =  (pHashMap->getMapHead()._iUsedChunk) * 1.0/pHashMap->allBlockChunkCount();

        if(rate >0.9)
        {
            pHashMap->expand(pHashMap->getMapHead()._iMemSize * 2);
            TLOGERROR("PropertyImp::handlePropMsg hashmap expand to " << pHashMap->getMapHead()._iMemSize << endl);
        }

        int iRet = pHashMap->add(tHead, body);
        if(iRet != TC_HashMap::RT_OK )
        {
            TLOGERROR("PropertyImp::handlePropMsg add hashmap recourd iRet:" << iRet << endl);
        }

        if(LOG->IsNeedLog(TarsRollLogger::INFO_LOG))
        {
            ostringstream os;
            os.str("");
            head.displaySimple(os);
            body.displaySimple(os);
            TLOGINFO("ret|"<<iRet<<"|"<<os.str()<< endl);
        }

    }

    return 0;
}