Skip to content

Commit

Permalink
Merge pull request #602 from mtbrandy/threadcount_aix
Browse files Browse the repository at this point in the history
Implement GetThreadCount for AIX.
  • Loading branch information
BillyDonahue committed Dec 10, 2015
2 parents 0162ff7 + bf7e9e8 commit ddb8012
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions googletest/src/gtest-port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
# include <sys/procfs.h>
#endif // GTEST_OS_QNX

#if GTEST_OS_AIX
# include <procinfo.h>
# include <sys/types.h>
#endif // GTEST_OS_AIX

#include "gtest/gtest-spi.h"
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-internal.h"
Expand Down Expand Up @@ -146,6 +151,19 @@ size_t GetThreadCount() {
}
}

#elif GTEST_OS_AIX

size_t GetThreadCount() {
struct procentry64 entry;
pid_t pid = getpid();
int status = getprocs64(&entry, sizeof(entry), NULL, 0, &pid, 1);
if (status == 1) {
return entry.pi_thcount;
} else {
return 0;
}
}

#else

size_t GetThreadCount() {
Expand Down

0 comments on commit ddb8012

Please sign in to comment.