Changeset 165 in pacpusframework for branches/2.0-beta1/examples
- Timestamp:
- Aug 1, 2013, 6:30:31 PM (11 years ago)
- Location:
- branches/2.0-beta1/examples/ProducerConsumerExample
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/examples/ProducerConsumerExample/ConsumerExample.cpp
r163 r165 52 52 LOG_TRACE(Q_FUNC_INFO); 53 53 moveToThread(&thread); 54 m_counter = 0; 54 55 55 m_counter = 0; 56 static const char * outputFileName = "test2.txt"; 56 static const char * outputFileName = "consumer.txt"; 57 57 m_file.open(outputFileName, std::ios_base::out | std::ios_base::app); 58 58 if (!m_file.is_open()) { … … 77 77 void ConsumerExample::process(const QImage& matrix) 78 78 { 79 LOG_INFO("Size " << matrix.size().width()<< " x " << matrix.size().height()); 80 unsigned int k = 0; 79 m_file << ++m_counter << " " << road_time() << "\n" << std::flush; 81 80 82 // a process83 for (int i = 0; i < 100; ++i) {84 ++k;85 } 86 m_file << ++m_counter << " " << road_time() << "\n";81 LOG_INFO("Received QIMage: " 82 << "size = " << matrix.size().width()<< " x " << matrix.size().height() 83 ); 84 85 // DO PROCESSING 87 86 88 87 setState(MONITOR_OK); -
branches/2.0-beta1/examples/ProducerConsumerExample/ProducerConsumerExample.xml
r163 r165 10 10 </connections> 11 11 12 <!-- FIXME: change into plugins --> 13 <parameters prefix="" postfix="_d" extension="dll"> 12 <plugins prefix="" postfix="" extension="dll"> 14 13 <plugin lib="ProducerConsumerExample" /> 15 <plugin lib="ShMem" /> 14 </plugins> 15 16 <parameters> 16 17 </parameters> 17 18 </pacpus> -
branches/2.0-beta1/examples/ProducerConsumerExample/ProducerExample.cpp
r163 r165 71 71 void ProducerExample::run() 72 72 { 73 unsigned int counter = 0;74 int waitTime = 5000;73 unsigned int counter = 1; 74 int waitTimeMicros = 150 * 1000; 75 75 76 76 std::fstream file(outputFileName, std::ios_base::out | std::ios_base::app); … … 87 87 while (isActive()) { 88 88 //mat.setPixel(0,0,i); 89 LOG_INFO("Size " << mat.size().width()<< " x " << mat.size().height()); 89 LOG_INFO("Sent QImage: " 90 << "size = " << mat.size().width()<< " x " << mat.size().height() 91 ); 90 92 91 93 if (imageOutput && imageOutput->hasConnection()) { … … 93 95 } 94 96 95 LOG_INFO("Sen d data " << counter << " time" << road_time());96 file << ++counter << " " << road_time() << "\n";97 LOG_INFO("Sent data=" << counter << ", time=" << road_time()); 98 file << counter << " " << road_time() << "\n" << std::flush; 97 99 98 usleep(waitTime );100 usleep(waitTimeMicros); 99 101 ++counter; 100 102 setState(MONITOR_OK);
Note:
See TracChangeset
for help on using the changeset viewer.