377 }
378
379 // If we found a matching file with a newer creation time, then
380 // save the user name. The newer creation time indicates that
381 // we found a newer incarnation of the process associated with
382 // vmid. Due to the way that Windows recycles pids and the fact
383 // that we can't delete the file from the file system namespace
384 // until last close, it is possible for there to be more than
385 // one hsperfdata file with a name matching vmid (diff users).
386 //
387 // We no longer ignore hsperfdata files where (st_size == 0).
388 // In this function, all we're trying to do is determine the
389 // name of the user that owns the process associated with vmid
390 // so the size doesn't matter. Very rarely, we have observed
391 // hsperfdata files where (st_size == 0) and the st_size field
392 // later becomes the expected value.
393 //
394 if (statbuf.st_ctime > latest_ctime) {
395 char* user = strchr(dentry->d_name, '_') + 1;
396
397 if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
398 latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
399
400 strcpy(latest_user, user);
401 latest_ctime = statbuf.st_ctime;
402 }
403
404 FREE_C_HEAP_ARRAY(char, filename);
405 }
406 }
407 os::closedir(subdirp);
408 FREE_C_HEAP_ARRAY(char, usrdir_name);
409 }
410 os::closedir(tmpdirp);
411
412 return(latest_user);
413 }
414
415 // return the name of the user that owns the process identified by vmid.
416 //
417 // note: this method should only be used via the Perf native methods.
|
377 }
378
379 // If we found a matching file with a newer creation time, then
380 // save the user name. The newer creation time indicates that
381 // we found a newer incarnation of the process associated with
382 // vmid. Due to the way that Windows recycles pids and the fact
383 // that we can't delete the file from the file system namespace
384 // until last close, it is possible for there to be more than
385 // one hsperfdata file with a name matching vmid (diff users).
386 //
387 // We no longer ignore hsperfdata files where (st_size == 0).
388 // In this function, all we're trying to do is determine the
389 // name of the user that owns the process associated with vmid
390 // so the size doesn't matter. Very rarely, we have observed
391 // hsperfdata files where (st_size == 0) and the st_size field
392 // later becomes the expected value.
393 //
394 if (statbuf.st_ctime > latest_ctime) {
395 char* user = strchr(dentry->d_name, '_') + 1;
396
397 FREE_C_HEAP_ARRAY(char, latest_user);
398 latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
399
400 strcpy(latest_user, user);
401 latest_ctime = statbuf.st_ctime;
402 }
403
404 FREE_C_HEAP_ARRAY(char, filename);
405 }
406 }
407 os::closedir(subdirp);
408 FREE_C_HEAP_ARRAY(char, usrdir_name);
409 }
410 os::closedir(tmpdirp);
411
412 return(latest_user);
413 }
414
415 // return the name of the user that owns the process identified by vmid.
416 //
417 // note: this method should only be used via the Perf native methods.
|