diff options
author | Bob Haarman <llvm@inglorion.net> | 2016-11-29 15:24:00 +0000 |
---|---|---|
committer | Bob Haarman <llvm@inglorion.net> | 2016-11-29 15:24:00 +0000 |
commit | 835a29632377870f0d7863f0101e1be441327476 (patch) | |
tree | 03a3a1bd1ca1808303dfb31c732e11f0ecea1c71 /lib/profile/InstrProfilingFile.c | |
parent | e575309787fb237fa6accae95c46f4d6c67ca772 (diff) |
[profile] use GetComputerNameExW instead of gethostname on Windows
Summary: In profile data paths, we replace "%h" with the hostname of the machine the program is running on. On Windows, we used gethostname() to obtain the hostname. This requires linking with ws2_32. With this change, we instead get the hostname from GetComputerNameExW(), which does not require ws2_32.
Reviewers: rnk, vsk, amccarth
Subscribers: zturner, ruiu, hans
Differential Revision: https://reviews.llvm.org/D27178
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingFile.c')
-rw-r--r-- | lib/profile/InstrProfilingFile.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c index 44f5d9ab8..f82080c98 100644 --- a/lib/profile/InstrProfilingFile.c +++ b/lib/profile/InstrProfilingFile.c @@ -300,18 +300,18 @@ static int parseFilenamePattern(const char *FilenamePat, if (FilenamePat[++I] == 'p') { if (!NumPids++) { if (snprintf(PidChars, MAX_PID_SIZE, "%d", getpid()) <= 0) { - PROF_WARN( - "Unable to parse filename pattern %s. Using the default name.", - FilenamePat); + PROF_WARN("Unable to get pid for filename pattern %s. Using the " + "default name.", + FilenamePat); return -1; } } } else if (FilenamePat[I] == 'h') { if (!NumHosts++) if (COMPILER_RT_GETHOSTNAME(Hostname, COMPILER_RT_MAX_HOSTLEN)) { - PROF_WARN( - "Unable to parse filename pattern %s. Using the default name.", - FilenamePat); + PROF_WARN("Unable to get hostname for filename pattern %s. Using " + "the default name.", + FilenamePat); return -1; } } else if (containsMergeSpecifier(FilenamePat, I)) { |