Commit 03a65cdb authored by Mathieu Faverge's avatar Mathieu Faverge

Support new naming convention in Paje, the old one is still supported

parent 205d4f05
...@@ -111,7 +111,7 @@ SET(VITE_HDRS ...@@ -111,7 +111,7 @@ SET(VITE_HDRS
parser/ParsingThread.hpp parser/ParsingThread.hpp
parser/Parser.hpp parser/Parser.hpp
parser/ParserFactory.hpp parser/ParserFactory.hpp
# Paje # Paje
parser/PajeParser/PajeDefinition.hpp parser/PajeParser/PajeDefinition.hpp
parser/PajeParser/PajeFileManager.hpp parser/PajeParser/PajeFileManager.hpp
parser/PajeParser/ParserDefinitionPaje.hpp parser/PajeParser/ParserDefinitionPaje.hpp
...@@ -150,7 +150,7 @@ SET(VITE_UIS ...@@ -150,7 +150,7 @@ SET(VITE_UIS
) )
SET(VITE_SRCS SET(VITE_SRCS
# Messages & Errors # Messages & Errors
common/Message.cpp common/Message.cpp
common/Errors.cpp common/Errors.cpp
common/Tools.cpp common/Tools.cpp
...@@ -268,7 +268,7 @@ IF(VITE_ENABLE_VBO) ...@@ -268,7 +268,7 @@ IF(VITE_ENABLE_VBO)
${VITE_SRCS} ${VITE_SRCS}
render/vbo.cpp render/vbo.cpp
render/Render_alternate.cpp render/Render_alternate.cpp
) )
ENDIF(VITE_ENABLE_VBO) ENDIF(VITE_ENABLE_VBO)
############################################# #############################################
...@@ -325,7 +325,7 @@ ENDIF(VITE_ENABLE_TAU) ...@@ -325,7 +325,7 @@ ENDIF(VITE_ENABLE_TAU)
#ADD_DEFINITIONS(-DMEMORY_USAGE) #ADD_DEFINITIONS(-DMEMORY_USAGE)
#ADD_DEFINITIONS(-DMEMORY_TRACE) #ADD_DEFINITIONS(-DMEMORY_TRACE)
############################################# #############################################
# BOOST # BOOST
############################################# #############################################
...@@ -333,23 +333,23 @@ IF(VITE_ENABLE_SERIALIZATION) ...@@ -333,23 +333,23 @@ IF(VITE_ENABLE_SERIALIZATION)
link_directories ( ${Boost_LIBRARY_DIRS} ) link_directories ( ${Boost_LIBRARY_DIRS} )
include_directories ( ${Boost_INCLUDE_DIRS} ) include_directories ( ${Boost_INCLUDE_DIRS} )
add_definitions("-DUSE_ITC -DBOOST_SERIALIZE") add_definitions("-DUSE_ITC -DBOOST_SERIALIZE")
SET(VITE_HDRS SET(VITE_HDRS
${VITE_HDRS} ${VITE_HDRS}
parser/ParserSplitted.hpp parser/ParserSplitted.hpp
trace/IntervalOfContainer.hpp trace/IntervalOfContainer.hpp
trace/SerializerWriter.hpp trace/SerializerWriter.hpp
trace/SerializerDispatcher.hpp trace/SerializerDispatcher.hpp
) )
SET(VITE_SRCS SET(VITE_SRCS
${VITE_SRCS} ${VITE_SRCS}
parser/ParserSplitted.cpp parser/ParserSplitted.cpp
trace/IntervalOfContainer.cpp trace/IntervalOfContainer.cpp
trace/SerializerWriter.cpp trace/SerializerWriter.cpp
trace/SerializerDispatcher.cpp trace/SerializerDispatcher.cpp
) )
ENDIF(VITE_ENABLE_SERIALIZATION) ENDIF(VITE_ENABLE_SERIALIZATION)
...@@ -386,7 +386,7 @@ if( APPLE ) ...@@ -386,7 +386,7 @@ if( APPLE )
SET( OSX_ICON_FILES "interface/icon/mac_logo.icns") SET( OSX_ICON_FILES "interface/icon/mac_logo.icns")
set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
ADD_EXECUTABLE(vite MACOSX_BUNDLE ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS} ${OSX_ICON_FILES}) ADD_EXECUTABLE(vite MACOSX_BUNDLE ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS} ${OSX_ICON_FILES})
SET_TARGET_PROPERTIES(vite PROPERTIES SET_TARGET_PROPERTIES(vite PROPERTIES
MACOSX_BUNDLE_INFO_STRING "ViTE" MACOSX_BUNDLE_INFO_STRING "ViTE"
MACOSX_BUNDLE_ICON_FILE "mac_logo.icns" MACOSX_BUNDLE_ICON_FILE "mac_logo.icns"
MACOSX_BUNDLE_LONG_VERSION_STRING "Visual Trace Explorer - version ${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}" MACOSX_BUNDLE_LONG_VERSION_STRING "Visual Trace Explorer - version ${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}"
...@@ -394,7 +394,7 @@ if( APPLE ) ...@@ -394,7 +394,7 @@ if( APPLE )
MACOSX_BUNDLE_SHORT_VERSION_STRING "ViTE-${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}" MACOSX_BUNDLE_SHORT_VERSION_STRING "ViTE-${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}"
MACOSX_BUNDLE_BUNDLE_VERSION "1.0" MACOSX_BUNDLE_BUNDLE_VERSION "1.0"
MACOSX_BUNDLE_COPYRIGHT "INRIA 2006-2012" MACOSX_BUNDLE_COPYRIGHT "INRIA 2006-2012"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/vite-info.plist.in) MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/vite-info.plist.in)
else( APPLE ) else( APPLE )
ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS}) ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
endif( APPLE ) endif( APPLE )
...@@ -410,7 +410,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ...@@ -410,7 +410,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
rt rt
) )
ADD_DEFINITIONS("-DBOOST_GZIP") ADD_DEFINITIONS("-DBOOST_GZIP")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(VITE_ENABLE_VBO) IF(VITE_ENABLE_VBO)
TARGET_LINK_LIBRARIES(vite TARGET_LINK_LIBRARIES(vite
......
...@@ -60,41 +60,41 @@ void print(std::vector<PajeFieldName>* fields, PajeDefinition *def) { ...@@ -60,41 +60,41 @@ void print(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
size_t size = def->_fields.size(); size_t size = def->_fields.size();
cout << def->_trid << " : " << def->_name << endl; cout << def->_trid << " : " << def->_name << endl;
for(i=0 ; i < size ; i ++){ for(i=0 ; i < size ; i ++){
PajeFieldName p; PajeFieldName p;
try{ try{
p = (*fields).at( def->_fields[i]._idname); p = (*fields).at( def->_fields[i]._idname);
cout << " " << p._name; cout << " " << p._name;
}catch(out_of_range& e){ }catch(out_of_range& e){
cout << " " << "name not found"; cout << " " << "name not found";
} }
string s; string s;
//as this won't change in the future, we can use a switch //as this won't change in the future, we can use a switch
switch(def->_fields[i]._idtype){ switch(def->_fields[i]._idtype){
case(1<<0) : case(1<<0) :
s="int"; s="int";
break; break;
case(1<<1) : case(1<<1) :
s="hex"; s="hex";
break; break;
case(1<<2) : case(1<<2) :
s="date"; s="date";
break; break;
case(1<<3) : case(1<<3) :
s="double"; s="double";
break; break;
case(1<<4) : case(1<<4) :
s="string"; s="string";
break; break;
case(1<<5) : case(1<<5) :
s="color"; s="color";
break; break;
default: default:
s="error : wrong type"; s="error : wrong type";
break; break;
} }
cout << " " << s << endl; cout << " " << s << endl;
} }
} }
...@@ -106,7 +106,7 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) { ...@@ -106,7 +106,7 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
outstream << def->_name; outstream << def->_name;
outstream << "\n"; outstream << "\n";
for(i=0 ; i < size ; i ++){ for(i=0 ; i < size ; i ++){
//try to find the name of the field we want to print //try to find the name of the field we want to print
PajeFieldName p; PajeFieldName p;
...@@ -116,33 +116,33 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) { ...@@ -116,33 +116,33 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
}catch(out_of_range& e){ }catch(out_of_range& e){
outstream << " " << "name not found"; outstream << " " << "name not found";
} }
string s; string s;
//as this won't change in the future, we can use a switch //as this won't change in the future, we can use a switch
switch(def->_fields[i]._idtype){ switch(def->_fields[i]._idtype){
case(1<<0) : case(1<<0) :
s="int"; s="int";
break; break;
case(1<<1) : case(1<<1) :
s="hex"; s="hex";
break; break;
case(1<<2) : case(1<<2) :
s="date"; s="date";
break; break;
case(1<<3) : case(1<<3) :
s="double"; s="double";
break; break;
case(1<<4) : case(1<<4) :
s="string"; s="string";
break; break;
case(1<<5) : case(1<<5) :
s="color"; s="color";
break; break;
default: default:
s="error : wrong type"; s="error : wrong type";
break; break;
} }
outstream << " " << s; outstream << " " << s;
outstream << "\n"; outstream << "\n";
} }
return outstream.str(); return outstream.str();
...@@ -150,19 +150,19 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) { ...@@ -150,19 +150,19 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
bool check_definition(PajeDefinition *def) { bool check_definition(PajeDefinition *def) {
int fdpresent = def->_fdpresent; int fdpresent = def->_fdpresent;
// If the definition requires Alias or Name, // If the definition requires Alias or Name,
// and the trace provide only one the both, it's ok // and the trace provide only one the both, it's ok
if ( ((def->_fdrequired & CODE(_PajeFN_Alias)) || if ( ((def->_fdrequired & CODE(_PajeFN_Alias)) ||
(def->_fdrequired & CODE(_PajeFN_Name ))) && (def->_fdrequired & CODE(_PajeFN_Name ))) &&
((def->_fdpresent & CODE(_PajeFN_Alias)) || ((def->_fdpresent & CODE(_PajeFN_Alias)) ||
(def->_fdpresent & CODE(_PajeFN_Name ))) ) { (def->_fdpresent & CODE(_PajeFN_Name ))) ) {
fdpresent = fdpresent | CODE(_PajeFN_Alias); fdpresent = fdpresent | CODE(_PajeFN_Alias);
fdpresent = fdpresent | CODE(_PajeFN_Name ); fdpresent = fdpresent | CODE(_PajeFN_Name );
} }
if ( (fdpresent & def->_fdrequired) == def->_fdrequired ) if ( (fdpresent & def->_fdrequired) == def->_fdrequired )
return true; return true;
else else
return false; return false;
} }
......
...@@ -82,23 +82,32 @@ ...@@ -82,23 +82,32 @@
* the need of the user. * the need of the user.
*/ */
#define FIELDNAME_SIZEMAX 32 #define FIELDNAME_SIZEMAX 32
#define FIELDNAME_SIZE 16 #define FIELDNAME_SIZE 14
#define _PajeFN_Time 0 #define _PajeFN_Time 0
#define _PajeFN_Name 1 #define _PajeFN_Name 1
#define _PajeFN_Alias 2 #define _PajeFN_Alias 2
#define _PajeFN_Type 3
#define _PajeFN_Container 4
#define _PajeFN_StartContainerType 5
#define _PajeFN_EndContainerType 6
#define _PajeFN_StartContainer 7
#define _PajeFN_EndContainer 8
#define _PajeFN_Color 9
#define _PajeFN_Value 10
#define _PajeFN_Key 11
#define _PajeFN_File 12
#define _PajeFN_Line 13
/*
* Former type that are no longer used in Paje Format.
* Kept here for compatibility
*/
#define _PajeFN_ContainerType 3 #define _PajeFN_ContainerType 3
#define _PajeFN_EntityType 4 #define _PajeFN_EntityType 3
#define _PajeFN_Type 5 #define _PajeFN_SourceContainerType 5
#define _PajeFN_Container 6 #define _PajeFN_DestContainerType 6
#define _PajeFN_SourceContainerType 7 #define _PajeFN_SourceContainer 7
#define _PajeFN_DestContainerType 8 #define _PajeFN_DestContainer 8
#define _PajeFN_SourceContainer 9
#define _PajeFN_DestContainer 10
#define _PajeFN_Color 11
#define _PajeFN_Value 12
#define _PajeFN_Key 13
#define _PajeFN_File 14
#define _PajeFN_Line 15
/*! /*!
* \brief Types for the fields * \brief Types for the fields
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the ** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info". ** URL: "http://www.cecill.info".
** **
** As a counterpart to the access to the source code and rights to copy, ** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided ** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of ** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited ** the economic rights, and the successive licensors have only limited
** liability. ** liability.
** **
** In this respect, the user's attention is drawn to the risks associated ** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the ** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software, ** software by the user in light of its specific status of free software,
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their ** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and ** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security. ** operate it in the same conditions as regards security.
** **
** The fact that you are presently reading this means that you have had ** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms. ** knowledge of the CeCILL-A license and that you accept its terms.
** **
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule ** - MARCOUEILLE Jule
** - NOISETTE Pascal ** - NOISETTE Pascal
** - REDONDY Arthur ** - REDONDY Arthur
** - VUCHENER Clément ** - VUCHENER Clément
** **
*/ */
/*! /*!
...@@ -50,21 +50,21 @@ ...@@ -50,21 +50,21 @@
struct PajeDefinition; struct PajeDefinition;
struct PajeFieldName; struct PajeFieldName;
/*! /*!
* \class ParserDefinitionPaje * \class ParserDefinitionPaje
* \brief Parse the header of the trace and store the information * \brief Parse the header of the trace and store the information
* about event description. * about event description.
* *
* \param _EvDefStr2Id * \param _EvDefStr2Id
* It is a hashtable to find quickly a match for * It is a hashtable to find quickly a match for
* each word found in definition section. It actually also * each word found in definition section. It actually also
* define the keyword which are allowed in the definition * define the keyword which are allowed in the definition
* section of a trace. This list is static, we initialize it * section of a trace. This list is static, we initialize it
* only once for all traces. The second term of each term is * only once for all traces. The second term of each term is
* the id of the event in the vector _EventDefs. * the id of the event in the vector _EventDefs.
* *
* \param _EvDefTrId2Id * \param _EvDefTrId2Id
* It is a hashtable to find quickly a match for * It is a hashtable to find quickly a match for
* each trace id used in the file to match an event. * each trace id used in the file to match an event.
* This hashtable is specific to each trace. * This hashtable is specific to each trace.
* *
...@@ -77,8 +77,8 @@ struct PajeFieldName; ...@@ -77,8 +77,8 @@ struct PajeFieldName;
* digit. * digit.
* *
* \param _FNameStr2Id * \param _FNameStr2Id
* It is an hashtable to find quickly a match for * It is an hashtable to find quickly a match for
* the keyword naming a definition's field. This hashtable * the keyword naming a definition's field. This hashtable
* can be complete by some new field added in the trace * can be complete by some new field added in the trace
* file. The second term of each pair is the id of the Name in * file. The second term of each pair is the id of the Name in
* the vector _FieldNames. * the vector _FieldNames.
...@@ -115,7 +115,7 @@ private: ...@@ -115,7 +115,7 @@ private:
* \brief Put the parser in definition mode * \brief Put the parser in definition mode
*/ */
void enter_definition(const PajeLine_t *line); void enter_definition(const PajeLine_t *line);
/*! /*!
* \fn leave_definition(const PajeLine_t *line) * \fn leave_definition(const PajeLine_t *line)
* \param line * \param line
......
This diff is collapsed.
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the ** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info". ** URL: "http://www.cecill.info".
** **
** As a counterpart to the access to the source code and rights to copy, ** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided ** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of ** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited ** the economic rights, and the successive licensors have only limited
** liability. ** liability.
** **
** In this respect, the user's attention is drawn to the risks associated ** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the ** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software, ** software by the user in light of its specific status of free software,
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their ** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and ** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security. ** operate it in the same conditions as regards security.
** **
** The fact that you are presently reading this means that you have had ** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms. ** knowledge of the CeCILL-A license and that you accept its terms.
** **
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule ** - MARCOUEILLE Jule
** - NOISETTE Pascal ** - NOISETTE Pascal
** - REDONDY Arthur ** - REDONDY Arthur
** - VUCHENER Clément ** - VUCHENER Clément
** **
*/ */
#include <iostream> #include <iostream>
...@@ -85,86 +85,86 @@ LARGE_INTEGER GetFrequency() ...@@ -85,86 +85,86 @@ LARGE_INTEGER GetFrequency()
//function for getting a quite accurate timestamp (used for debug purposes and performance evaluation) //function for getting a quite accurate timestamp (used for debug purposes and performance evaluation)
unsigned long long getCurrentTime (){ unsigned long long getCurrentTime (){
#ifndef WIN32 #ifndef WIN32
// Get current time in microseconds // Get current time in microseconds
struct timeval ts; struct timeval ts;
gettimeofday(&ts,NULL); gettimeofday(&ts,NULL);
unsigned long long timeValue = 0; unsigned long long timeValue = 0;
timeValue = (1000000 * (unsigned long long)ts.tv_sec) + (unsigned long long)ts.tv_usec; timeValue = (1000000 * (unsigned long long)ts.tv_sec) + (unsigned long long)ts.tv_usec;
//unsigned long long timeValue = (100000000000000000); //unsigned long long timeValue = (100000000000000000);
//double t2=ts.tv_sec+(ts.tv_usec/1000000.0); //double t2=ts.tv_sec+(ts.tv_usec/1000000.0);
//printf("Current Time: %llu µs \n", timeValue); //printf("Current Time: %llu µs \n", timeValue);
return timeValue; return timeValue;
#else #else
LARGE_INTEGER tick, freq; LARGE_INTEGER tick, freq;
freq = GetFrequency(); freq = GetFrequency();
QueryPerformanceCounter(&tick); QueryPerformanceCounter(&tick);
return tick.QuadPart / freq.QuadPart; return tick.QuadPart / freq.QuadPart;
#endif #endif
} }
*/ */
using namespace std; using namespace std;
mt_ParserPaje::mt_ParserPaje() : _ParserDefinition(new ParserDefinitionPaje()), mt_ParserPaje::mt_ParserPaje() : _ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL){} _ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL){}
mt_ParserPaje::mt_ParserPaje(const string &filename) : Parser(filename), mt_ParserPaje::mt_ParserPaje(const string &filename) : Parser(filename),
_ParserDefinition(new ParserDefinitionPaje()), _ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL) {} _ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL) {}
mt_ParserPaje::~mt_ParserPaje() { mt_ParserPaje::~mt_ParserPaje() {
delete _ParserDefinition; delete _ParserDefinition;
delete _ParserEvent; delete _ParserEvent;
if (_file != NULL) if (_file != NULL)
delete _file; delete _file;
} }
void mt_ParserPaje::parse(Trace &trace, void mt_ParserPaje::parse(Trace &trace,
bool finish_trace_after_parse) { bool finish_trace_after_parse) {
static const string PERCENT = "%"; static const string PERCENT = "%";
#ifdef DBG_PARSER_PAJE #ifdef DBG_PARSER_PAJE
int lineid = 0; int lineid = 0;
#endif #endif
// Open the trace // Open the trace
try { try {
_file = new mt_PajeFileManager(_file_to_parse.c_str()); _file = new mt_PajeFileManager(_file_to_parse.c_str());
} catch (const char *) { } catch (const char *) {
delete _file; delete _file;
_file = NULL; _file = NULL;
_is_canceled = true; _is_canceled = true;
finish(); finish();
trace.finish(); trace.finish();
std::cerr << "Cannot open file " << _file_to_parse.c_str() << std::endl; std::cerr << "Cannot open file " << _file_to_parse.c_str() << std::endl;
Error::set(Error::VITE_ERR_OPEN, 0, Error::VITE_ERRCODE_WARNING); Error::set(Error::VITE_ERR_OPEN, 0, Error::VITE_ERRCODE_WARNING);
return; return;
} }
QWaitCondition ended; QWaitCondition ended;
QWaitCondition trace_ended; QWaitCondition trace_ended;
QMutex mutex; QMutex mutex;
QMutex mutex2; QMutex mutex2;
QSemaphore freeSlots(5); QSemaphore freeSlots(5);
QSemaphore linesProduced(5); QSemaphore linesProduced(5);
_ParserEvent->setTrace(&trace); _ParserEvent->setTrace(&trace);
//this object will handle syntaxic verification of the events //this object will handle syntaxic verification of the events
BuilderThread bt(_ParserEvent, &trace, &ended, &trace_ended, &freeSlots, &linesProduced, &mutex, &mutex2); BuilderThread bt(_ParserEvent, &trace, &ended, &trace_ended, &freeSlots, &linesProduced, &mutex, &mutex2);
bt.connect((const QObject*)this, bt.connect((const QObject*)this,
SIGNAL(produced(int, PajeLine*)), SIGNAL(produced(int, PajeLine*)),
SLOT(run(int, PajeLine*))); SLOT(run(int, PajeLine*)));
bt.connect((const QObject*)this, bt.connect((const QObject*)this,
SIGNAL(build_finish()), SIGNAL(build_finish()),
SLOT(finish_build())); SLOT(finish_build()));
QThread consumerThread; QThread consumerThread;
bt.moveToThread(&consumerThread); bt.moveToThread(&consumerThread);
//this object will handle all trace operations //this object will handle all trace operations
TraceBuilderThread T_bt(&trace_ended, &freeSlots, &mutex2); TraceBuilderThread T_bt(&trace_ended, &freeSlots, &mutex2);
T_bt.connect((const QObject*)&bt, T_bt.connect((const QObject*)&bt,
SIGNAL(build_trace(int, Trace_builder_struct*)), SIGNAL(build_trace(int, Trace_builder_struct*)),
...@@ -176,82 +176,82 @@ void mt_ParserPaje::parse(Trace &trace, ...@@ -176,82 +176,82 @@ void mt_ParserPaje::parse(Trace &trace,
QThread traceBuilderThread; QThread traceBuilderThread;
T_bt.moveToThread(&traceBuilderThread); T_bt.moveToThread(&traceBuilderThread);
// they both get their own thread // they both get their own thread
consumerThread.start(); consumerThread.start();
traceBuilderThread.start(); traceBuilderThread.start();
//we use blocks of 10000 lines //we use blocks of 10000 lines
PajeLine* line=(PajeLine*)calloc(10000,sizeof(PajeLine)); PajeLine* line=(PajeLine*)calloc(10000,sizeof(PajeLine));
int i=0; int i=0;
while( (!(_file->eof())) && !(_is_canceled) ) { while( (!(_file->eof())) && !(_is_canceled) ) {
try { try {
#ifdef DBG_PARSER_PAJE #ifdef DBG_PARSER_PAJE
if ( (lineid+1) == _file->get_line(&line[i]) ) if ( (lineid+1) == _file->get_line(&line[i]) )
{ {
_file->print_line(); _file->print_line();
lineid++