Ignore:
Timestamp:
Nov 30, 2011, 2:58:20 PM (14 years ago)
Author:
dmik
Message:

Use pid instead of the ordinal number in log file names.

This in particular fixes the problem when WGSS50 writes to the log
before the ordinal is correctly initialized by KERNEL32 which resulted
into two processes writing to the same log file.

This also guarantees that a subsequent re-run will not vanish the
previous log file which is also useful sometimes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/kernel32/perfview.cpp

    r7413 r21837  
    2828#else
    2929
     30#include <process.h>
     31
    3032#include <ccollection.h>
    3133#include <winbase.h>
    3234
    3335// imported from the kernel loader (initterm)
    34 extern int loadNr;
    3536extern char  kernel32Path[];
    3637
     
    348349  char szFilename[260];
    349350
    350   sprintf(szFilename, "perf_%d.log", loadNr);
     351  sprintf(szFilename, "perf_%d.log", getpid());
    351352  _privateLogFile = fopen(szFilename, "w");
    352353 
    353354  if(_privateLogFile == NULL)
    354355  {
    355     sprintf(szFilename, "%sperf_%d.log", kernel32Path, loadNr);
     356    sprintf(szFilename, "%sperf_%d.log", kernel32Path, getpid());
    356357    _privateLogFile = fopen(szFilename, "w");
    357358  }
Note: See TracChangeset for help on using the changeset viewer.