Exemplo n.º 1
0
	void test_SPI_framework_2(void)
	{
		#if CDH_PROCESSOR_COMPILE
			logLine("testing CDH SPI with framework (2)");
			logLine("    transmitting: pwnage<-");
			logLine("    with one TX");
			Byte array[8] = {'p','w','n','a','g','e','<','-'};
			SPI_transmitStream(&devices.COM_Processor, array, 8, true);
			
			SPI_transmit(&devices.COM_Processor, '\r', true);
			SPI_transmit(&devices.COM_Processor, '\n', true);
		
		#else
			logLine("testing COM SPI with framework (2)");
			int i;
			for (i = 0; i < 10; i++)
			{
				SPI_receive(&devices.CDH_Processor, true);
				char received = devices.CDH_Processor.receiveMessage[0];
				if (received != DUMMY_CHAR)
				{
					printf("%c", received);
				}
			}
			printf("\r\nfinished receiving\r\n");
			fflush(stdout);
		#endif
	}
Exemplo n.º 2
0
	void Connection::connect()
	{
		boost::asio::ip::tcp::resolver resolver(m_Io);
		boost::asio::ip::tcp::resolver::query query(m_Address, m_Port);
		boost::system::error_code error = boost::asio::error::host_not_found;

		auto iter = resolver.resolve(query);
		decltype(iter) end;

		while (iter != end) 
		{
			if (!error)
			{
				break;
			}

			m_Socket.close();
			logLine("Info", "Trying to connect: " + m_Address + ":" + m_Port);

			m_Socket.connect(*iter++, error);

			if (error)
			{
				logLine("ERROR", error.message());
			}
		}

		if (error)
		{
			throw std::runtime_error(error.message());
		}

		logLine("Info", "Connected!");
	}
Exemplo n.º 3
0
bool process::insertTrapAtEntryPointOfMain() {
  int_function *f_main = 0;
  pdvector<int_function *> funcs;
    
  //first check a.out for function symbol   
  bool res = findFuncsByPretty("main", funcs);
  if (!res)
    {
      logLine( "a.out has no main function. checking for PLT entry\n" );
      //we have not found a "main" check if we have a plt entry
      res = findFuncsByPretty( "DYNINST_pltMain", funcs );
 
      if (!res) {
	logLine( "no PLT entry for main found\n" );
	return false;
      }       
    }
    
  if( funcs.size() > 1 ) {
    cerr << __FILE__ << __LINE__ 
	 << ": found more than one main! using the first" << endl;
  }
  f_main = funcs[0];
  assert(f_main);
  Address addr = f_main->getAddress();

  InsnAddr iAddr = InsnAddr::generateFromAlignedDataAddress( addr, this );
  iAddr.saveMyBundleTo( savedCodeBuffer );
  iAddr.replaceBundleWith( generateTrapBundle() );
    
  main_brk_addr = addr;
  return true;
} /* end insertTrapAtEntryPointOfMain() */
Exemplo n.º 4
0
void test_application_main(void)
{
	//test_SPI();
	//test_analogToDigital();

	//test_SPI_framework();
	//test_SPI_framework_2();
	//int i;
	//for (i = 0;i < 10000;i++)
	//{
	//	test_realTimeClock();
	//}
	//int i;
	//for (i = 0;i < 10000;i++)
	//{
		//test_sdCard();
	//}
	

	//test_COMmain();

	//test_thermocouple();
	
	//test_digitalToAnalog();
	//test_radio();
	//test_PSK();
	//test_toneGenerator();

	#if DebugMode
		
		#if RTC_CONNECTED
			test_realTimeClock();
			test_BinaryCodedDecimal();
		#endif
		
		#if SD_CONNECTED
			test_sdCard();
		#endif
	#endif

		//test_SPI_framework();
		//test_SPI_framework_2();
		//test_COMmain();
		//test_thermocouple();
		//test_digitalToAnalog();
		//test_radio();
		//test_PSK();
		//test_toneGenerator();

		//test_SPI();
		//test_analogToDigital();
	
	test_packetGrabbing();
	
	logLine("");
	logLine("All tests complete! --------------------");
	system_abort();
}
Exemplo n.º 5
0
	//--------------------------------------------------------------------
	void Profiler::logResults(Log::LogTarget lt){

		// if the profiler is enabled
		if (!mEnabled)
			return;
		
		// sort the history so we get profiles that need more time on the top
		mProfileHistory.sort();
				
		ProfileHistoryList::iterator iter;
	
		NR_Log(lt,  "--------------------------------------Profiler Results------------------------------");
		NR_Log(lt,  "| Name                        | Avg(\%) | Max(\%) | Min(\%) | Time sec     |  Calls   |");
		NR_Log(lt,  "------------------------------------------------------------------------------------");

		// log system results
		NR_Log(lt,  "| System Profiles                                                                  |");
		for (iter = mProfileHistory.begin(); iter != mProfileHistory.end(); iter++)
		{
			// only for system profiles
			if (iter->isSystemProfile){
				// create an indent that represents the hierarchical order of the profile
				std::string indent = "   ";
				//for (uint32 i = 0; i < (*iter).hierarchicalLvl; i++)
				//	indent = indent + " --";
				indent += (*iter).name;
				indent.resize(27, ' ');
	
				logLine(indent.c_str(), iter->minTime, iter->maxTime, iter->realTime, iter->totalTime, iter->totalCalls);
			}
		}
		
		// log application results
		NR_Log(lt,  "|----------------------------------------------------------------------------------|");
		NR_Log(lt,  "| Application Profiles                                                             |");
		for (iter = mProfileHistory.begin(); iter != mProfileHistory.end(); iter++)
		{
			// only for application profiles
			if (!iter->isSystemProfile){
				// create an indent that represents the hierarchical order of the profile
				std::string indent = "   ";
				//for (uint32 i = 0; i < (*iter).hierarchicalLvl; i++)
				//	indent = indent + " --";
				indent += (*iter).name;
				indent.resize(27, ' ');
	
				logLine(indent.c_str(), iter->minTime, iter->maxTime, iter->realTime, iter->totalTime, iter->totalCalls);
			}
		}
	
		NR_Log(lt,  "|                                                                                  |");
		NR_Log(lt,  "------------------------------------------------------------------------------------");

	}
Exemplo n.º 6
0
// getLinkMapAddrs: returns a vector of addresses corresponding to all 
// base addresses in the link maps.  Returns 0 on error.
pdvector<Address> *dynamic_linking::getLinkMapAddrs() {

    r_debug debug_elm;
    if(!proc->readDataSpace((caddr_t)(r_debug_addr),
        sizeof(r_debug),(caddr_t)&(debug_elm),true)) {
        // bperr("read d_ptr_addr failed r_debug_addr = 0x%lx\n",r_debug_addr);
        return 0;
    }

    bool first_time = true;
    Link_map *next_link_map = debug_elm.r_map;
    Address next_addr = (Address)next_link_map; 
    pdvector<Address> *link_addresses = new pdvector<Address>;
    while(next_addr != 0) {
	Link_map link_elm;
        if(!proc->readDataSpace((caddr_t)(next_addr),
            sizeof(Link_map),(caddr_t)&(link_elm),true)) {
            logLine("read next_link_map failed\n");
	    return 0;
        }
	// kludge: ignore the first entry
	if(!first_time) { 
	    (*link_addresses).push_back(link_elm.l_addr); 
	}
	else {
	    // bperr("first link map addr 0x%x\n",link_elm.l_addr);
	}

	first_time = false;
	next_addr = (Address)link_elm.l_next;
    }
    return link_addresses;
    link_addresses = 0;
}
Exemplo n.º 7
0
	void Connection::read(const boost::system::error_code& error, std::size_t count)
	{
		if (error)
		{
			// Got error...
			logLine("ERROR", "Connection said something..." + error.message());

			if (
				error == boost::asio::error::connection_reset ||
				error == boost::asio::error::broken_pipe ||
				error == boost::asio::error::not_found
				)
			{
				connect();
			}
			else
			{
				close();
			}
		}
		else
		{
			m_ReadHandler(std::string(m_ReadBuffer.data(), count));

			async_read();
		}
	}
Exemplo n.º 8
0
	void Connection::close()
	{
		logLine("INFO", "Closing connection to " + m_Address + ":" + m_Port);

		m_Socket.close();
		m_Io.stop();
	}
Exemplo n.º 9
0
	void test_SPI_framework(void)
	{
		#if CDH_PROCESSOR_COMPILE
			logLine("testing CDH SPI with framework");
			logLine("    transmitting: Kane is awesome **********");
			SPI_transmit(&devices.COM_Processor, 'K', true);
			SPI_transmit(&devices.COM_Processor, 'a', true);
			SPI_transmit(&devices.COM_Processor, 'n', true);
			SPI_transmit(&devices.COM_Processor, 'e', true);
			SPI_transmit(&devices.COM_Processor, ' ', true);
			SPI_transmit(&devices.COM_Processor, 'i', true);
			SPI_transmit(&devices.COM_Processor, 's', true);
			SPI_transmit(&devices.COM_Processor, ' ', true);
			SPI_transmit(&devices.COM_Processor, 'a', true);
			SPI_transmit(&devices.COM_Processor, 'w', true);
			SPI_transmit(&devices.COM_Processor, 'e', true);
			SPI_transmit(&devices.COM_Processor, 's', true);
			SPI_transmit(&devices.COM_Processor, 'o', true);
			SPI_transmit(&devices.COM_Processor, 'm', true);
			SPI_transmit(&devices.COM_Processor, 'e', true);
			SPI_transmit(&devices.COM_Processor, ' ', true);
		
			int i;
			for (i = 0; i < 10; i++)
			{
				SPI_transmit(&devices.COM_Processor, '*', true);
			}
			
			SPI_transmit(&devices.COM_Processor, '\r', true);
			SPI_transmit(&devices.COM_Processor, '\n', true);
			
		#else
			logLine("testing COM SPI with framework");
			int i;
			for (i = 0; i < 28; i++)
			{
				SPI_receive(&devices.CDH_Processor, true);
				char received = devices.CDH_Processor.receiveMessage[0];
				if (received != DUMMY_CHAR)
				{
					printf("%c", received);
				}
			}
			printf("\r\nfinished receiving\r\n");
			fflush(stdout);
		#endif
	}
Exemplo n.º 10
0
int Core::processWithDef(string &stp) {
    map<string,string>::iterator d_it;
    
    while (true) {
        string v_name;
        size_t in_p, out_p;

        in_p = stp.find("{{");
        
        if (in_p == string::npos) {
            // we do not need to proceed string without template tags
            return 0;
        }
        
        in_p += 2; // offset from tag begining
        
        out_p = stp.find("}}", in_p);
        
        if (out_p == string::npos) {
            // probably not properly closed tag, but we do not care
            return 0;
        }
        
        v_name = stp.substr(in_p, out_p-in_p);
        
        trim(v_name);
        
        if (v_name.size() == 0) {
            logLine("core", LOG_ERROR, "template without variable");
            return -1;
        }
        
        d_it = definitions.find(v_name);
        
        if (d_it == definitions.end()) {
            logLine("core", LOG_ERROR, "got template definition without predefined value: " + v_name);
            return -2;
        }

        // finaly replacing template with value
        stp.replace(in_p-2, out_p-in_p+4, (*d_it).second);
        logLine("core", LOG_DEBUG, stp);
    }
    
    // nice isn`t? 
    return 0;
}
Exemplo n.º 11
0
boost::format  MyLog::getStatus(){
    //boost::timer::cpu_times elapsedT=m_timer.elapsed();
    unsigned int elapsed = m_timer.elapsed()+m_timerOffset;
    //unsigned int elapsed = elapsedT.wall+m_timerOffset;
    boost::format logLine("%4d:%02d [%-50s] - ");
    logLine % (elapsed / 60);
    logLine % (elapsed % 60);
    logLine % m_stage;
        
    return logLine;
}
Exemplo n.º 12
0
void EmulApp::soundServerHasOutput()
{
    if (!soundServerProc) return;
    QString str = soundServerProc->readAllStandardOutput();
    QStringList lines = str.split(QRegExp("[\n\r]"));
    for (QStringList::iterator it = lines.begin(); it != lines.end(); ++it) {
        str = *it;
        while (str.endsWith('\n') || str.endsWith('\r')) str = str.left(str.length()-1);
        if (str.length()) // suppress empties?
            logLine(QString("[SoundServer] ") + str, QColor(0xcc, 0x33, 0x66));
    }
}
Exemplo n.º 13
0
bool SignalHandler::handleProcessExit(EventRecord &ev, bool &continueHint) 
{
  bool ret = false;
  process *proc = ev.proc;


  if (ev.status == statusNormal) {
      sprintf(errorLine, "Process %d has terminated with code 0x%x\n",
              proc->getPid(), (int) ev.what);
      statusLine(errorLine);
#if defined(os_windows)
      //  on the unixes we do this at syscall exit()
      proc->triggerNormalExitCallback(ev.what);
#endif
      ret = proc->handleProcessExit();
   } else if (ev.status == statusSignalled) {
      sprintf(errorLine, "process %d has terminated on signal %d\n",
              proc->getPid(), (int) ev.what);
      logLine(errorLine);
      statusLine(errorLine);
      printDyninstStats();
      // The process is gone at this point; we just have a return code.
      // So handle the exit _before_ we do the user-level callback, as
      // it sets state appropriately.
      ret = proc->handleProcessExit();
      proc->triggerSignalExitCallback(ev.what);
    } else {
      sprintf(errorLine, "process %d has terminated for unknown reason\n",
              proc->getPid());
      logLine(errorLine);
      ret = proc->handleProcessExit();
      //ret = true; //  maybe this should be false?  (this case is an error)
    }
  handleProcessExitPlat(ev, continueHint);
  flagBPatchStatusChange();

  continueHint = false;

  return ret;
}
Exemplo n.º 14
0
void test_application_initialize(void)
{
	#if DebugMode
		
		#if SD_CONENCTED
			clearDigitalOutput(devices.sdCard.SPI.chipSelect.out);
		#endif
		
		#if LogicAnalyzerDelay
			printf("time to start logic analyzer... ");
			fflush(stdout);
			UL32 wait;
			UL32 dummy = 0;
			for (wait = 0; wait < 60000; wait++)
			{
				dummy++;
				if (dummy > 1000)
				{
					printf(".");
					dummy = 0;
					fflush(stdout);
				}
			}
			printf("done! starting test program\r\n");
			fflush(stdout);
		#endif
		
		// start printing to file
		#if CDH_PROCESSOR_COMPILE
			logLine("running test on CDH processor");
			logLine("please check UMSATS_CDH_log.txt");
		#else
			logLine("running test on COM processor");
			logLine("please check UMSATS_COM_log.txt");
		#endif
		initializeLogFile();
		
	#endif
}
Exemplo n.º 15
0
 void logMsg(int level, const char* format, ...)
 {
   if (!format)
     return;
   va_list args;
   va_start(args, format);
   char buf[4096];
   vsnprintf(buf, sizeof(buf), format, args);
   buf[sizeof(buf)-1]='\0';
   va_end(args);
   std::string str(buf);
   //FIXME:  removeNewLineChars(str);
   logLine(level, str.c_str());
 }
Exemplo n.º 16
0
	void test_digitalToAnalog(void)
	{
		logLine("testing D to A conversion");
		
		int D2A_tests;
		for (D2A_tests = 0; D2A_tests < 10; D2A_tests++)
		{ 
			int i;
			for (i = 0; i < 0xFFF; i++)
			{
				#if COM_PROCESSOR_COMPILE
				
					devices.radio.microphone->value = i;
					startNewDigitalToAnalogConversion(devices.radio.microphone->value);
					
				#endif
			}
		}
	}
Exemplo n.º 17
0
void Logger::writeLog(const char *functionName, const char *fileName, int lineNumber, std::string message, ...) {
  va_list args;
  
  if (access(getLogFileName().c_str(), W_OK) == -1) {
    return;
  }
  
	FILE *log;
  log = fopen(getLogFileName().c_str(), "a");
  
  string logLinePrefix = logLine(functionName, fileName, lineNumber);
  fprintf(log, "%s ", logLinePrefix.c_str());
	va_start(args, message);
	vfprintf(log, message.c_str(), args);
	va_end(args);
	fprintf(log, "\n");
	fclose(log);
  
}
Exemplo n.º 18
0
int Core::addDefinition(char *arg) {
    string key, val;
    
    key = arg;
    trim(key);
    
    size_t eq_pos = key.find("=");
    if (eq_pos == string::npos) {
        return -1; // no equal in definition
    }
    
    val = key.substr(eq_pos+1, key.size());
    key = key.substr(0, eq_pos);
    
    logLine("core", LOG_DEBUG, "global definition: " + key + ":" + val);
        
    if ((key.size() == 0) || (val.size() == 0)) {
        return -2;
    }    

    definitions[key] = val;
    return 0;
}
Exemplo n.º 19
0
	void test_PSK(void)
	{
		logLine("Testing PSK");
		
		disableInterrupts();
	
		Byte data[8];
		data[0] = 0xFF;
		data[1] = 0xFF;
		data[2] = 0xA1;
		data[3] = 0x2C;
		data[4] = 0xB6;
		data[5] = 0x10;
		data[6] = 0x00;
		data[7] = 0x89;
		
		printf("data: ");
		int i;
		for(i = 0; i < 8; i++)
		{
			printf(" %x\t", data[i]);
		}
		fflush(stdout);
		
		convertBinaryToPSK(data,8);
		
		printf("\n\nPhase Shift History: ");
		for(i = 0; i < PhaseShiftHistoryLength; i++)
		{
			printf("%d, ", phaseShifts[i]);
		}
		printf("\n");
    //
	///convertBinaryToPSK(data,32); // TODO: leftover from merge. Should it be here?
		
		enableInterrupts();
}
Exemplo n.º 20
0
void ChatWindow::logText(const QString& text)
{
    if(log())
    {
        // "cd" into log path or create path, if it's not there
        cdIntoLogPath();

        if(logfile.open(QIODevice::WriteOnly | QIODevice::Append))
        {
            // wrap the file into a stream
            QTextStream logStream(&logfile);
            // write log in utf8 to help i18n
            logStream.setCodec(QTextCodec::codecForName("UTF-8"));
            logStream.setAutoDetectUnicode(true);

            if(firstLog)
            {
                QString intro(i18n("\n*** Logfile started\n*** on %1\n\n", QDateTime::currentDateTime().toString()));
                logStream << intro;
                firstLog=false;
            }

            QDateTime dateTime = QDateTime::currentDateTime();
            QString logLine(QString("[%1] [%2] %3\n").arg(QLocale().toString(dateTime.date(), QLocale::LongFormat)).
                arg(QLocale().toString(dateTime.time(), QLocale::LongFormat)).arg(text));
            logStream << logLine;

            // detach stream from file
            logStream.setDevice(0);

            // close file
            logfile.close();
        }
        else qWarning() << "open(QIODevice::Append) for " << logfile.fileName() << " failed!";
    }
}
Exemplo n.º 21
0
	void test_radio(void)
	{
		#if COM_PROCESSOR_COMPILE
			logLine("testing output to radio");
			
			// 500 mV / 3.3 V = 620 / 4096
			#define radio_high 620
			#define radio_low 0
			
			bool toggle = low;
			
			for (;;)
			{
				toggle = toggle ? low : high;
				devices.radio.microphone->value = toggle ? radio_high : radio_low;
				startNewDigitalToAnalogConversion(devices.radio.microphone->value);
				int i;
				for (i = 0; i < 12000; i++) ; // wait
			}
			
			#undef radio_high
			#undef radio_low
		#endif
	}
Exemplo n.º 22
0
void insnCodeGen::generateBranch(codeGen &gen, long disp, bool link)
{
    if (ABS(disp) > MAX_BRANCH) {
	// Too far to branch, and no proc to register trap.
	fprintf(stderr, "ABS OFF: 0x%lx, MAX: 0x%lx\n",
           ABS(disp), (unsigned long) MAX_BRANCH);
	bperr( "Error: attempted a branch of 0x%lx\n", disp);
	logLine("a branch too far\n");
	showErrorCallback(52, "Internal error: branch too far");
	bperr( "Attempted to make a branch of offset 0x%lx\n", disp);
	assert(0);
    }

    instruction insn;
    IFORM_OP_SET(insn, Bop);
    IFORM_LI_SET(insn, disp >> 2);
    IFORM_AA_SET(insn, 0);
    if (link)
        IFORM_LK_SET(insn, 1);
    else
        IFORM_LK_SET(insn, 0);

    insnCodeGen::generate(gen,insn);
}
Exemplo n.º 23
0
	void test_SPI(void)
	{
		logLine("testing SPI");
		
		P5DIR |= BIT1;                // P5.1 as output
	  	P5OUT |= BIT1;                // P5.1 set high
	
		// testing SPI
	
		#if CDH_PROCESSOR_COMPILE
		
			// TODO uncomment and test
			/*
		
			P3OUT &= ~0x01;		// slave enable
			
			char nextCharToSend = '1';
			for(;;nextCharToSend++)
			{
	
				UCB0CTL1 |= UCSWRST;
				UCB0CTL1 &= ~UCSWRST;
				if (nextCharToSend == ':') nextCharToSend = '1';
				
				P3OUT &= ~0x01;  // set STE low for slave enable
				char buff = spiSendByte(nextCharToSend);
				printf("recieved: %c\n", buff);
				
				P3OUT |= 0x01; // set STE high for slave disable
				
				// just a time killing loop
				int waitTimer;
				for (waitTimer = 10000; waitTimer > 0; waitTimer--){ ; }
		
			}
			*/
		#else		// SLAVE
			// TODO uncomment
			/*
			printf("    COM Slave Initialize\r\n");
			printf("Searching for: %c\n", 'C');
			fflush(stdout);
			
		  int x;
		  for(x =0;x<100;x++)
		  {
	
			UCB0CTL1 |= UCSWRST;
			UCB0CTL1 &= ~UCSWRST;
		  	UCB0TXBUF = 'C';
			while((P3IN & 0x01) == 0x01);	// wait for enable
			bool enabled = ((P3IN | 0xFE) == 0xFE);
			if (enabled)
			{
				char buff = UCB0RXBUF;
				printf("recieved: %c\n", buff);
				
			}
			
		  }
		  */
		#endif
		
	}
Exemplo n.º 24
0
	void test_analogToDigital(void)
	{
		// TODO
		logLine("testing A to D conversion");
	}
Exemplo n.º 25
0
	void Connection::write(const std::string& content)
	{
		logLine("WRITE", content);
		boost::asio::write(m_Socket, boost::asio::buffer(content + "\r\n"));
	}
Exemplo n.º 26
0
void
dyninst_log_perror(const char* msg) {
    sprintf(errorLine, "%s: %s\n", msg, strerror(errno));
    logLine(errorLine);
    // fprintf(stderr, "%s", log_buffer);
}
Exemplo n.º 27
0
//
// All costs are based on Measurements on a SPARC station 10/40.
//
void initPrimitiveCost()
{
    /* Need to add code here to collect values for other machines */

    // this doesn't really take any time
    primitiveCosts["DYNINSTbreakPoint"] = 1;

    // this happens before we start keeping time.
    primitiveCosts["DYNINSTinit"] = 1;

    primitiveCosts["DYNINSTprintCost"] = 1;

    //
    // I can't find DYNINSTincrementCounter or DYNINSTdecrementCounter
    // I think they are not being used anywhere - naim
    //
    // isthmus acutal numbers from 7/3/94 -- jkh
    // 240 ns
    primitiveCosts["DYNINSTincrementCounter"] = 16;
    // 240 ns
    primitiveCosts["DYNINSTdecrementCounter"] = 16;

#if defined(i386_unknown_solaris2_5)
    logLine("Solaris/x86 platform\n");
    // Updated calculation of the cost for the following procedures.
    // cost in cycles

    // Values (in cycles) benchmarked on a Pentium II 400MHz
    // Level 2 - Software Level
    primitiveCosts["DYNINSTstartWallTimer"] = 1304;
    primitiveCosts["DYNINSTstopWallTimer"] = 1321;
    primitiveCosts["DYNINSTstartProcessTimer"] = 1324;
    primitiveCosts["DYNINSTstopProcessTimer"] = 1350;

    // These happen async of the rest of the system.
    primitiveCosts["DYNINSTalarmExpire"] = 3724;
    primitiveCosts["DYNINSTsampleValues"] = 13;
    primitiveCosts["DYNINSTreportTimer"] = 1380;
    primitiveCosts["DYNINSTreportCounter"] = 1270;
    primitiveCosts["DYNINSTreportCost"] = 1350;
    primitiveCosts["DYNINSTreportNewTags"] = 837;

#elif defined(sparc_sun_solaris2_4)
    logLine("Solaris platform\n");

    // Values (in cycles) benchmarked on an UltraSparcIIi 440MHz
    // Level 2 - Software Level
    primitiveCosts["DYNINSTstartWallTimer"] = 248;
    primitiveCosts["DYNINSTstopWallTimer"] = 277;
    primitiveCosts["DYNINSTstartProcessTimer"] = 105;
    primitiveCosts["DYNINSTstopProcessTimer"] = 104;

    // These happen async of the rest of the system.
    // 148 usecs * 37.04 Mhz
    primitiveCosts["DYNINSTalarmExpire"] = 5513;
    // 0.81 usecs * 37.04 Mhz
    primitiveCosts["DYNINSTsampleValues"] = 30;
    // 23.08 usecs * 37.04 Mhz
    primitiveCosts["DYNINSTreportTimer"] = 855;
    // 7.85 usecs * 37.04 Mhz
    primitiveCosts["DYNINSTreportCounter"] = 290;
    // 4.22 usecs * 37.04 Mhz
    primitiveCosts["DYNINSTreportCost"] = 156;
    // 1.03 usecs * 37.04 Mhz
    primitiveCosts["DYNINSTreportNewTags"] = 38;
#endif
}
Exemplo n.º 28
0
void duLogBuildTimes(rcContext& ctx, const int totalTimeUsec)
{
	const float pc = 100.0f / totalTimeUsec;
 
	ctx.log(RC_LOG_PROGRESS, "Build Times");
	logLine(ctx, RC_TIMER_RASTERIZE_TRIANGLES,		"- Rasterize", pc);
	logLine(ctx, RC_TIMER_BUILD_COMPACTHEIGHTFIELD,	"- Build Compact", pc);
	logLine(ctx, RC_TIMER_FILTER_BORDER,				"- Filter Border", pc);
	logLine(ctx, RC_TIMER_FILTER_WALKABLE,			"- Filter Walkable", pc);
	logLine(ctx, RC_TIMER_ERODE_AREA,				"- Erode Area", pc);
	logLine(ctx, RC_TIMER_MEDIAN_AREA,				"- Median Area", pc);
	logLine(ctx, RC_TIMER_MARK_BOX_AREA,				"- Mark Box Area", pc);
	logLine(ctx, RC_TIMER_MARK_CONVEXPOLY_AREA,		"- Mark Convex Area", pc);
	logLine(ctx, RC_TIMER_BUILD_DISTANCEFIELD,		"- Build Disntace Field", pc);
	logLine(ctx, RC_TIMER_BUILD_DISTANCEFIELD_DIST,	"    - Distance", pc);
	logLine(ctx, RC_TIMER_BUILD_DISTANCEFIELD_BLUR,	"    - Blur", pc);
	logLine(ctx, RC_TIMER_BUILD_REGIONS,				"- Build Regions", pc);
	logLine(ctx, RC_TIMER_BUILD_REGIONS_WATERSHED,	"    - Watershed", pc);
	logLine(ctx, RC_TIMER_BUILD_REGIONS_EXPAND,		"      - Expand", pc);
	logLine(ctx, RC_TIMER_BUILD_REGIONS_FLOOD,		"      - Find Basins", pc);
	logLine(ctx, RC_TIMER_BUILD_REGIONS_FILTER,		"    - Filter", pc);
	logLine(ctx, RC_TIMER_BUILD_CONTOURS,			"- Build Contours", pc);
	logLine(ctx, RC_TIMER_BUILD_CONTOURS_TRACE,		"    - Trace", pc);
	logLine(ctx, RC_TIMER_BUILD_CONTOURS_SIMPLIFY,	"    - Simplify", pc);
	logLine(ctx, RC_TIMER_BUILD_POLYMESH,			"- Build Polymesh", pc);
	logLine(ctx, RC_TIMER_BUILD_POLYMESHDETAIL,		"- Build Polymesh Detail", pc);
	logLine(ctx, RC_TIMER_MERGE_POLYMESH,			"- Merge Polymeshes", pc);
	logLine(ctx, RC_TIMER_MERGE_POLYMESHDETAIL,		"- Merge Polymesh Details", pc);
	ctx.log(RC_LOG_PROGRESS, "=== TOTAL:\t%.2fms", totalTimeUsec/1000.0f);
}
Exemplo n.º 29
0
void LogPlay::SendNowNext()
{
  QTime end_time;
  QTime time;
  int now_line=-1;
  RDLogLine *logline[2];
  RDLogLine *ll;
  RDLogLine *default_now_logline=NULL;
  RDLogLine *default_next_logline=NULL;

  //
  // Get NOW PLAYING Event
  //
  if(play_nownext_address.isNull()&&play_nownext_rml.isEmpty()&&
     (play_rlm_hosts->size()==0)) {
    return;
  }
  QString cmd=play_nownext_string;
  int lines[TRANSPORT_QUANTITY];
  int running=runningEvents(lines,false);
  for(int i=0;i<running;i++) {
    if((time=logLine(lines[i])->startTime(RDLogLine::Actual).
	addMSecs(logLine(lines[i])->effectiveLength()))>end_time) {
      end_time=time;
      now_line=lines[i];
    }
  }
  if((now_line>=0)&&(logLine(now_line)->nowNextEnabled())) {
    logline[0]=logLine(now_line);
  }
  else {
    if(play_now_cartnum==0) {
      logline[0]=NULL;
    }
    else {
      default_now_logline=new RDLogLine(play_now_cartnum);
      logline[0]=default_now_logline;
    }
  }

  //
  // Get NEXT Event
  //
  logline[1]=NULL;
  for(int i=nextLine();i<size();i++) {
    if((ll=logLine(i))!=NULL) {
      if((ll->status()==RDLogLine::Scheduled)&&
	 logLine(i)->nowNextEnabled()&&(!logLine(i)->asyncronous())) {
	logline[1]=logLine(i);
	i=size();
      }
    }
  }
  if((logline[1]==NULL)&&(play_next_cartnum!=0)) {
    default_next_logline=new RDLogLine(play_next_cartnum);
    logline[1]=default_next_logline;
  }

  //
  // Process and Send It
  //
  unsigned nowcart=0;
  unsigned nextcart=0;
  if(logline[0]!=NULL) {
    if(!logline[0]->asyncronous()) {
      nowcart=logline[0]->cartNumber();
    }
  }
  if(logline[1]!=NULL) {
    nextcart=logline[1]->cartNumber();
  }
  if((nowcart==play_prevnow_cartnum)&&(nextcart==play_prevnext_cartnum)) {
    return;
  }
  if(logline[0]==NULL) {
    play_prevnow_cartnum=0;
  }
  else {
    play_prevnow_cartnum=logline[0]->cartNumber();
  }
  if(logline[1]==NULL) {
    play_prevnext_cartnum=0;
  }
  else {
    play_prevnext_cartnum=logline[1]->cartNumber();
  }
  QString svcname=play_svc_name;
  if(svcname.isEmpty()) {
    svcname=play_defaultsvc_name;
  }
  for(unsigned i=0;i<play_rlm_hosts->size();i++) {
    play_rlm_hosts->at(i)->
      sendEvent(svcname,logName().left(logName().length()-4),play_id,logline,
		play_onair_flag,play_op_mode);
  }
  RDResolveNowNext(&cmd,logline,0);
  play_nownext_socket->
    writeBlock(cmd,cmd.length(),play_nownext_address,play_nownext_port);

  cmd=play_nownext_rml;
  RDResolveNowNext(&cmd,logline,0);
  rdevent_player->exec(cmd);

  //
  // Clean up
  //
  if(default_now_logline!=NULL) {
    delete default_now_logline;
  }
  if(default_next_logline!=NULL) {
    delete default_next_logline;
  }
}
Exemplo n.º 30
0
// processLinkMaps: This routine is called by getSharedObjects to  
// process all shared objects that have been mapped into the process's
// address space.  This routine reads the link maps from the application 
// process to find the shared object file base mappings. It returns 0 on error.
bool dynamic_linking::processLinkMaps(pdvector<fileDescriptor> &descs) {
   r_debug debug_elm;
   if(!proc->readDataSpace((caddr_t)(r_debug_addr),
                        sizeof(r_debug),(caddr_t)&(debug_elm),true)) {
      // bperr("read d_ptr_addr failed r_debug_addr = 0x%lx\n",r_debug_addr);
      return 0;
   }

   // get each link_map object
   Link_map *next_link_map = debug_elm.r_map;
   Address next_addr = (Address)next_link_map; 
   
   while(next_addr != 0){
       Link_map link_elm;

       if(!proc->readDataSpace((caddr_t)(next_addr),
                               sizeof(Link_map),(caddr_t)&(link_elm),true)) {
           logLine("read next_link_map failed\n");
           return 0;
       }
       // get file name
       char f_name[256]; // assume no file names greater than 256 chars
       // check to see if reading 256 chars will go out of bounds
       // of data segment
       u_int f_amount = 256;
       bool done = false;
       for(u_int i=0; (i<256) && (!done); i++){
           if(!proc->readDataSpace((caddr_t)((u_int)(link_elm.l_name)+i),
                                   sizeof(char),(caddr_t)(&(f_name[i])),true)){
           }
           if(f_name[i] == '\0'){
               done = true;
               f_amount = i+1;
           }
       }
       f_name[f_amount-1] = '\0';
       pdstring obj_name = pdstring(f_name);

      parsing_cerr << 
         "dynamicLinking::processLinkMaps(): file name of next shared obj="
                     << obj_name << endl;

      // create a mapped_object and add it to the list
      // kludge: ignore the entry if it has the same name as the
      // executable file...this seems to be the first link-map entry
      // VG(09/25/01): also ignore if address is 65536 or name is (unknown)
      if(obj_name != proc->getAOut()->fileName() && 
         obj_name != proc->getAOut()->fullName() &&
         link_elm.l_addr != 65536 &&
         obj_name != "(unknown)"
         //strncmp(obj_name.c_str(), "(unknown)", 10)
         ) {
          
          fileDescriptor desc = fileDescriptor(obj_name, link_elm.l_addr,
                                               link_elm.l_addr,
                                               true);
          descs.push_back(desc);          
      }
      
      next_addr = (Address)link_elm.l_next;
   }

   return true;
}