Callgrind output: Encode the thread name and the total time the thread
used into the file name. This makes it easier to find the thread(s) one is looking for. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28446 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9da2356857
commit
cd65e69b00
@ -167,12 +167,24 @@ void
|
||||
CallgrindThreadProfileResult::PrintResults()
|
||||
{
|
||||
// create output file
|
||||
|
||||
// create output dir
|
||||
mkdir(gOptions.callgrind_directory, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
|
||||
char fileName[B_PATH_NAME_LENGTH];
|
||||
snprintf(fileName, sizeof(fileName), "%s/callgrind.out.%ld",
|
||||
gOptions.callgrind_directory, fThread->ID());
|
||||
// get the thread name and replace slashes by hyphens
|
||||
char threadName[B_OS_NAME_LENGTH];
|
||||
strlcpy(threadName, fThread->Name(), sizeof(threadName));
|
||||
char* slash = threadName;
|
||||
while ((slash = strchr(slash, '/')) != NULL)
|
||||
*slash = '-';
|
||||
|
||||
// create the file name
|
||||
char fileName[B_PATH_NAME_LENGTH];
|
||||
snprintf(fileName, sizeof(fileName), "%s/callgrind.out.%ld.%s.%lldms",
|
||||
gOptions.callgrind_directory, fThread->ID(), threadName,
|
||||
fTotalTicks * fInterval);
|
||||
|
||||
// create the file
|
||||
FILE* out = fopen(fileName, "w+");
|
||||
if (out == NULL) {
|
||||
fprintf(stderr, "%s: Failed to open output file \"%s\": %s\n",
|
||||
|
Loading…
Reference in New Issue
Block a user