25 #define DIR_SEPARATOR '\\'    27 #define DIR_SEPARATOR '/'    29 #include <sys/types.h>    35 #include <sys/syslimits.h>    39 #include "JackCompilerDeps.h"    40 #include "JackError.h"    60         static void KillServer();
    62         static int MkDir(
const char* path);
    63         static char* UserDir();
    64         static char* ServerDir(
const char* server_name, 
char* server_dir);
    65         static const char* DefaultServerName();
    66         static void CleanupFiles(
const char* server_name);
    67         static int GetTmpdir();
    68         static void RewriteName(
const char* name, 
char* new_name);
    69         static void ThrowJackNetException();
    72         static int ComputationMicroSec(
int buffer_size)
    74             if (buffer_size < 128) {
    76             } 
else if (buffer_size < 256) {
   104             uint32_t fMeasureCnt;
   105             uint32_t fMeasurePoints;
   115                     jack_log ( 
"JackGnuPlotMonitor::JackGnuPlotMonitor %u measure points - %u measures", measure_points, measure_cnt );
   117                     fMeasureCnt = measure_cnt;
   118                     fMeasurePoints = measure_points;
   121                     fCurrentMeasure = 
new T[fMeasurePoints];
   122                     fMeasureTable = 
new T*[fMeasureCnt];
   123                     for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
   125                             fMeasureTable[cnt] = 
new T[fMeasurePoints];
   126                             std::fill_n ( fMeasureTable[cnt], fMeasurePoints, 0 );
   132                     jack_log ( 
"JackGnuPlotMonitor::~JackGnuPlotMonitor" );
   134                     for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
   135                             delete[] fMeasureTable[cnt];
   136                     delete[] fMeasureTable;
   137                     delete[] fCurrentMeasure;
   140             T AddNew(T measure_point)
   143                     return fCurrentMeasure[fMeasureId++] = measure_point;
   148                     return fMeasureId = 0;
   151             T Add(T measure_point)
   153                     return fCurrentMeasure[fMeasureId++] = measure_point;
   156             uint32_t AddLast(T measure_point)
   158                     fCurrentMeasure[fMeasureId] = measure_point;
   165                     for ( uint32_t point = 0; point < fMeasurePoints; point++ )
   166                             fMeasureTable[fTablePos][point] = fCurrentMeasure[point];
   167                     if ( ++fTablePos == fMeasureCnt )
   172             int Save(std::string name = std::string ( 
"" ))
   174                     std::string filename = ( name.empty() ) ? fName : name;
   177                     jack_log ( 
"JackGnuPlotMonitor::Save filename %s", filename.c_str() );
   179                     std::ofstream file ( filename.c_str() );
   181                     for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
   183                             for ( uint32_t point = 0; point < fMeasurePoints; point++ )
   184                                     file << fMeasureTable[cnt][point] << 
" \t";
   192             int SetPlotFile(std::string* options_list, uint32_t options_number,
   193                             std::string* field_names, uint32_t field_number,
   194                             std::string name = std::string ( 
"" ))
   196                     std::string title = ( name.empty() ) ? fName : name;
   197                     std::string plot_filename = title + 
".plt";
   198                     std::string data_filename = title + 
".log";
   200                     std::ofstream file ( plot_filename.c_str() );
   202                     file << 
"set multiplot" << std::endl;
   203                     file << 
"set grid" << std::endl;
   204                     file << 
"set title \"" << title << 
"\"" << std::endl;
   206                     for ( uint32_t i = 0; i < options_number; i++ )
   207                             file << options_list[i] << std::endl;
   210                     for ( uint32_t row = 1; row <= field_number; row++ )
   212                             file << 
"\"" << data_filename << 
"\" using " << row << 
" title \"" << field_names[row-1] << 
"\" with lines";
   213                             file << ( ( row < field_number ) ? 
", " : 
"\n" );
   216                     jack_log ( 
"JackGnuPlotMonitor::SetPlotFile - Save GnuPlot file to '%s'", plot_filename.c_str() );
   224     void BuildClientPath(
char* path_to_so, 
int path_len, 
const char* so_name);
   225     void PrintLoadError(
const char* so_name);
 
Generic monitoring class. Saves data to GnuPlot files ('.plt' and '.log' datafile)
SERVER_EXPORT void jack_log(const char *fmt,...)