Changeset 151 for Evidence/DColl.cc


Ignore:
Timestamp:
01/18/10 13:10:57 (15 years ago)
Author:
ogrimm
Message:
DColl publishes also current data file name
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Evidence/DColl.cc

    r145 r151  
    4949               
    5050    unsigned int NumItems;
     51        char *Filename;
    5152    FILE *DataFile;
    5253    FILE *LogFile;
     
    5455        int DataSizeLastUpdate, LogSizeLastUpdate;
    5556        char *DataDir;
    56     DimService *LogSizeService, *DataSizeService;
     57    DimService *LogSizeService, *DataSizeService, *DataFilename;
    5758    int HistSize;
    5859        int SizeUpdateDelay;
     
    7980
    8081  // Initialization to prevent freeing unallocated memory
     82  Filename = NULL;
    8183  DataFile = NULL;
    8284  LogFile = NULL;
     
    105107  LogCommand = new DimCommand("DColl/Log", (char *) "C", this);
    106108             
    107   // Create services for file sizes
     109  // Create services for file sizes and data file name
    108110  DataSizekB = 0;
    109111  DataSizeService = new DimService(SERVER_NAME "/DataSizekB", DataSizekB);
     
    111113  LogSizekB = FileSize(LogFile);
    112114  LogSizeService = new DimService(SERVER_NAME "/LogSizekB", LogSizekB);
     115
     116  DataFilename = new DimService(SERVER_NAME "/CurrentFile", (char *) "");
    113117
    114118  // Count how many minimum change value regular expressions are present
     
    162166  free(List);
    163167
     168  delete DataFilename;
    164169  //delete LogSizeService; // These create segmentation faults?!
    165170  //delete DataSizeService;
    166171
    167172  delete LogCommand;
     173  free(Filename);
    168174
    169175  // Close files
     
    243249        if (mktime(T) == -1) State(ERROR, "mktime() failed, check filename");
    244250
    245         char *Filename;
     251        free(Filename);
    246252        if (MakeString(&Filename, "%s/%d%02d%02d.slow", DataDir, T->tm_year+1900, T->tm_mon+1, T->tm_mday) == -1) State(FATAL, "Could not create filename, MakeString() failed");
    247253        if ((DataFile = fopen(Filename, "a")) == NULL) {
     
    249255        }
    250256        else State(INFO, "Opened data file '%s'", Filename);
    251         free(Filename);
     257        DataFilename->updateService(Filename);
    252258       
    253259        // Calculate time for next file opening
Note: See TracChangeset for help on using the changeset viewer.