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
parser/ParsingThread.hpp
parser/Parser.hpp
parser/ParserFactory.hpp
# Paje
# Paje
parser/PajeParser/PajeDefinition.hpp
parser/PajeParser/PajeFileManager.hpp
parser/PajeParser/ParserDefinitionPaje.hpp
......@@ -150,7 +150,7 @@ SET(VITE_UIS
)
SET(VITE_SRCS
# Messages & Errors
# Messages & Errors
common/Message.cpp
common/Errors.cpp
common/Tools.cpp
......@@ -268,7 +268,7 @@ IF(VITE_ENABLE_VBO)
${VITE_SRCS}
render/vbo.cpp
render/Render_alternate.cpp
)
)
ENDIF(VITE_ENABLE_VBO)
#############################################
......@@ -325,7 +325,7 @@ ENDIF(VITE_ENABLE_TAU)
#ADD_DEFINITIONS(-DMEMORY_USAGE)
#ADD_DEFINITIONS(-DMEMORY_TRACE)
#############################################
# BOOST
#############################################
......@@ -333,23 +333,23 @@ IF(VITE_ENABLE_SERIALIZATION)
link_directories ( ${Boost_LIBRARY_DIRS} )
include_directories ( ${Boost_INCLUDE_DIRS} )
add_definitions("-DUSE_ITC -DBOOST_SERIALIZE")
SET(VITE_HDRS
${VITE_HDRS}
parser/ParserSplitted.hpp
trace/IntervalOfContainer.hpp
trace/SerializerWriter.hpp
parser/ParserSplitted.hpp
trace/IntervalOfContainer.hpp
trace/SerializerWriter.hpp
trace/SerializerDispatcher.hpp
)
SET(VITE_SRCS
${VITE_SRCS}
parser/ParserSplitted.cpp
trace/IntervalOfContainer.cpp
trace/SerializerWriter.cpp
parser/ParserSplitted.cpp
trace/IntervalOfContainer.cpp
trace/SerializerWriter.cpp
trace/SerializerDispatcher.cpp
)
)
ENDIF(VITE_ENABLE_SERIALIZATION)
......@@ -386,7 +386,7 @@ if( APPLE )
SET( OSX_ICON_FILES "interface/icon/mac_logo.icns")
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})
SET_TARGET_PROPERTIES(vite PROPERTIES
SET_TARGET_PROPERTIES(vite PROPERTIES
MACOSX_BUNDLE_INFO_STRING "ViTE"
MACOSX_BUNDLE_ICON_FILE "mac_logo.icns"
MACOSX_BUNDLE_LONG_VERSION_STRING "Visual Trace Explorer - version ${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}"
......@@ -394,7 +394,7 @@ if( APPLE )
MACOSX_BUNDLE_SHORT_VERSION_STRING "ViTE-${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}"
MACOSX_BUNDLE_BUNDLE_VERSION "1.0"
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 )
ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
endif( APPLE )
......@@ -410,7 +410,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
rt
)
ADD_DEFINITIONS("-DBOOST_GZIP")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(VITE_ENABLE_VBO)
TARGET_LINK_LIBRARIES(vite
......
......@@ -60,41 +60,41 @@ void print(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
size_t size = def->_fields.size();
cout << def->_trid << " : " << def->_name << endl;
for(i=0 ; i < size ; i ++){
PajeFieldName p;
PajeFieldName p;
try{
p = (*fields).at( def->_fields[i]._idname);
cout << " " << p._name;
}catch(out_of_range& e){
cout << " " << "name not found";
}
string s;
string s;
//as this won't change in the future, we can use a switch
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
default:
s="error : wrong type";
break;
}
cout << " " << s << endl;
cout << " " << s << endl;
}
}
......@@ -106,7 +106,7 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
outstream << def->_name;
outstream << "\n";
for(i=0 ; i < size ; i ++){
//try to find the name of the field we want to print
PajeFieldName p;
......@@ -116,33 +116,33 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
}catch(out_of_range& e){
outstream << " " << "name not found";
}
string s;
string s;
//as this won't change in the future, we can use a switch
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
switch(def->_fields[i]._idtype){
case(1<<0) :
s="int";
break;
case(1<<1) :
s="hex";
break;
case(1<<2) :
s="date";
break;
case(1<<3) :
s="double";
break;
case(1<<4) :
s="string";
break;
case(1<<5) :
s="color";
break;
default:
s="error : wrong type";
break;
}
outstream << " " << s;
outstream << "\n";
outstream << " " << s;
outstream << "\n";
}
return outstream.str();
......@@ -150,19 +150,19 @@ string print_string(std::vector<PajeFieldName>* fields, PajeDefinition *def) {
bool check_definition(PajeDefinition *def) {
int fdpresent = def->_fdpresent;
// If the definition requires Alias or Name,
// and the trace provide only one the both, it's ok
if ( ((def->_fdrequired & CODE(_PajeFN_Alias)) ||
(def->_fdrequired & CODE(_PajeFN_Name ))) &&
((def->_fdpresent & CODE(_PajeFN_Alias)) ||
(def->_fdpresent & CODE(_PajeFN_Name ))) ) {
fdpresent = fdpresent | CODE(_PajeFN_Alias);
fdpresent = fdpresent | CODE(_PajeFN_Name );
(def->_fdrequired & CODE(_PajeFN_Name ))) &&
((def->_fdpresent & CODE(_PajeFN_Alias)) ||
(def->_fdpresent & CODE(_PajeFN_Name ))) ) {
fdpresent = fdpresent | CODE(_PajeFN_Alias);
fdpresent = fdpresent | CODE(_PajeFN_Name );
}
if ( (fdpresent & def->_fdrequired) == def->_fdrequired )
return true;
return true;
else
return false;
}
......
......@@ -82,23 +82,32 @@
* the need of the user.
*/
#define FIELDNAME_SIZEMAX 32
#define FIELDNAME_SIZE 16
#define FIELDNAME_SIZE 14
#define _PajeFN_Time 0
#define _PajeFN_Name 1
#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_EntityType 4
#define _PajeFN_Type 5
#define _PajeFN_Container 6
#define _PajeFN_SourceContainerType 7
#define _PajeFN_DestContainerType 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
#define _PajeFN_EntityType 3
#define _PajeFN_SourceContainerType 5
#define _PajeFN_DestContainerType 6
#define _PajeFN_SourceContainer 7
#define _PajeFN_DestContainer 8
/*!
* \brief Types for the fields
......
......@@ -6,13 +6,13 @@
** 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
** URL: "http://www.cecill.info".
**
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
......@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
**
** 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.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
/*!
......@@ -50,21 +50,21 @@
struct PajeDefinition;
struct PajeFieldName;
/*!
/*!
* \class ParserDefinitionPaje
* \brief Parse the header of the trace and store the information
* about event description.
*
* \param _EvDefStr2Id
* It is a hashtable to find quickly a match for
* each word found in definition section. It actually also
* define the keyword which are allowed in the definition
* It is a hashtable to find quickly a match for
* each word found in definition section. It actually also
* define the keyword which are allowed in the definition
* section of a trace. This list is static, we initialize it
* only once for all traces. The second term of each term is
* the id of the event in the vector _EventDefs.
*
* \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.
* This hashtable is specific to each trace.
*
......@@ -77,8 +77,8 @@ struct PajeFieldName;
* digit.
*
* \param _FNameStr2Id
* It is an hashtable to find quickly a match for
* the keyword naming a definition's field. This hashtable
* It is an hashtable to find quickly a match for
* the keyword naming a definition's field. This hashtable
* 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
* the vector _FieldNames.
......@@ -115,7 +115,7 @@ private:
* \brief Put the parser in definition mode
*/
void enter_definition(const PajeLine_t *line);
/*!
* \fn leave_definition(const PajeLine_t *line)
* \param line
......
This diff is collapsed.
......@@ -6,13 +6,13 @@
** 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
** URL: "http://www.cecill.info".
**
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
......@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
**
** 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.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
#include <iostream>
......@@ -85,86 +85,86 @@ LARGE_INTEGER GetFrequency()
//function for getting a quite accurate timestamp (used for debug purposes and performance evaluation)
unsigned long long getCurrentTime (){
#ifndef WIN32
// Get current time in microseconds
struct timeval ts;
gettimeofday(&ts,NULL);
unsigned long long timeValue = 0;
timeValue = (1000000 * (unsigned long long)ts.tv_sec) + (unsigned long long)ts.tv_usec;
//unsigned long long timeValue = (100000000000000000);
//double t2=ts.tv_sec+(ts.tv_usec/1000000.0);
//printf("Current Time: %llu µs \n", timeValue);
return timeValue;
// Get current time in microseconds
struct timeval ts;
gettimeofday(&ts,NULL);
unsigned long long timeValue = 0;
timeValue = (1000000 * (unsigned long long)ts.tv_sec) + (unsigned long long)ts.tv_usec;
//unsigned long long timeValue = (100000000000000000);
//double t2=ts.tv_sec+(ts.tv_usec/1000000.0);
//printf("Current Time: %llu µs \n", timeValue);
return timeValue;
#else
LARGE_INTEGER tick, freq;
LARGE_INTEGER tick, freq;
freq = GetFrequency();
QueryPerformanceCounter(&tick);
return tick.QuadPart / freq.QuadPart;
#endif
}
*/
using namespace std;
mt_ParserPaje::mt_ParserPaje() : _ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL){}
mt_ParserPaje::mt_ParserPaje() : _ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL){}
mt_ParserPaje::mt_ParserPaje(const string &filename) : Parser(filename),
_ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL) {}
mt_ParserPaje::mt_ParserPaje(const string &filename) : Parser(filename),
_ParserDefinition(new ParserDefinitionPaje()),
_ParserEvent(new mt_ParserEventPaje(_ParserDefinition)), _file(NULL) {}
mt_ParserPaje::~mt_ParserPaje() {
delete _ParserDefinition;
delete _ParserEvent;
if (_file != NULL)
delete _file;
delete _file;
}
void mt_ParserPaje::parse(Trace &trace,
bool finish_trace_after_parse) {
void mt_ParserPaje::parse(Trace &trace,
bool finish_trace_after_parse) {
static const string PERCENT = "%";
#ifdef DBG_PARSER_PAJE
int lineid = 0;
#endif
// Open the trace
try {
_file = new mt_PajeFileManager(_file_to_parse.c_str());
_file = new mt_PajeFileManager(_file_to_parse.c_str());
} catch (const char *) {
delete _file;
_file = NULL;
delete _file;
_file = NULL;
_is_canceled = true;
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);
return;
}
return;
}
QWaitCondition ended;
QWaitCondition trace_ended;
QWaitCondition trace_ended;
QMutex mutex;
QMutex mutex2;
QMutex mutex2;
QSemaphore freeSlots(5);
QSemaphore linesProduced(5);
_ParserEvent->setTrace(&trace);
//this object will handle syntaxic verification of the events
_ParserEvent->setTrace(&trace);
//this object will handle syntaxic verification of the events
BuilderThread bt(_ParserEvent, &trace, &ended, &trace_ended, &freeSlots, &linesProduced, &mutex, &mutex2);
bt.connect((const QObject*)this,
SIGNAL(produced(int, PajeLine*)),
SLOT(run(int, PajeLine*)));
bt.connect((const QObject*)this,
bt.connect((const QObject*)this,
SIGNAL(build_finish()),
SLOT(finish_build()));
QThread consumerThread;
QThread 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);
T_bt.connect((const QObject*)&bt,
SIGNAL(build_trace(int, Trace_builder_struct*)),
......@@ -176,82 +176,82 @@ void mt_ParserPaje::parse(Trace &trace,
QThread traceBuilderThread;
T_bt.moveToThread(&traceBuilderThread);
// they both get their own thread
// they both get their own thread
consumerThread.start();
traceBuilderThread.start();
//we use blocks of 10000 lines
//we use blocks of 10000 lines
PajeLine* line=(PajeLine*)calloc(10000,sizeof(PajeLine));
int i=0;
int i=0;
while( (!(_file->eof())) && !(_is_canceled) ) {
try {
#ifdef DBG_PARSER_PAJE
if ( (lineid+1) == _file->get_line(&line[i]) )
{
_file->print_line();
lineid++;
}
if ( (lineid+1) == _file->get_line(&line[i]) )
{
_file->print_line();
lineid++;
}
#else
_file->get_line(&line[i]);
#endif
_file->get_line(&line[i]);
#endif
}
catch(char const *){
Error::set(Error::VITE_ERR_EXPECT_ID_DEF, 0, Error::VITE_ERRCODE_ERROR);
continue;
}
catch(char const *){
Error::set(Error::VITE_ERR_EXPECT_ID_DEF, 0, Error::VITE_ERRCODE_ERROR);
continue;
}
// If it's an empty line
if (line[i]._nbtks == 0) {
continue;
}
// The line starts by a '%' : it's a definition
else if(line[i]._tokens[0][0] == '%') {
// If it's an empty line
if (line[i]._nbtks == 0) {
continue;
}
// The line starts by a '%' : it's a definition
else if(line[i]._tokens[0][0] == '%') {
_ParserDefinition->store_definition(&line[i]);
}
// It's an event
else {
// It's an event
else {
i++;
if(i==10000){//we finished to build a block, send it to the BuilderThread
linesProduced.acquire();
emit produced(i, line);
i=0;
line=(PajeLine*)calloc(10000,sizeof(PajeLine));
//if a chunk of file is finished, wait for its complete treatment before releasing the chunk
// avoids reading too quickly in the file
if(_file->eoc()){
linesProduced.acquire(5);
_file->close_old_chunk();
linesProduced.release(5);
}
}
if(i==10000){//we finished to build a block, send it to the BuilderThread
linesProduced.acquire();
emit produced(i, line);
i=0;
line=(PajeLine*)calloc(10000,sizeof(PajeLine));
//if a chunk of file is finished, wait for its complete treatment before releasing the chunk
// avoids reading too quickly in the file
if(_file->eoc()){
linesProduced.acquire(5);
_file->close_old_chunk();
linesProduced.release(5);
}
}
}
}
//send the last batch
emit produced(i, line);
line=NULL;
//send the finish signal to the BuilderThread, which will do the same to the TraceBuilderThread
//both threads will then be finished and ready to destroy
//locks the mutex and automatically unlocks it when going out of scope
QMutexLocker locker(&mutex);
emit build_finish();
ended.wait(&mutex);
locker.unlock();
//both threads will then be finished and ready to destroy
//locks the mutex and automatically unlocks it when going out of scope
QMutexLocker locker(&mutex);
emit build_finish();
ended.wait(&mutex);
locker.unlock();
traceBuilderThread.quit();
traceBuilderThread.wait();
consumerThread.quit();
consumerThread.wait();
consumerThread.quit();
consumerThread.wait();
if(finish_trace_after_parse) {
trace.finish();
finish();
}
......@@ -261,8 +261,7 @@ void mt_ParserPaje::parse(Trace &trace,
float mt_ParserPaje::get_percent_loaded() const {
if (_file != NULL)
return _file->get_percent_loaded();
return _file->get_percent_loaded();
else
return 0.;
return 0.;
}
This diff is collapsed.
......@@ -41,16 +41,14 @@ typedef struct Trace_builder_struct{
void (*func)(Trace_builder_struct*);
Date time;
Name alias;
String container_type;
String source_container_type;
String dest_container_type;
String entity_type;
String type;
String start_container_type;
String end_container_type;
String container;
String value_string;
Double value_double;
String source_container;
String dest_container;
String start_container;
String end_container;
String key;
std::map<std::string, Value *> extra_fields;
//std::map<std::string, Value *> *extra_fields;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment