diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-02-09 20:20:22 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-02-09 20:20:22 +0000 |
commit | 2efa586395d7a39364a080903f26a32ebbaadb13 (patch) | |
tree | 43e7a1a4c8fa5b889c6e2b4c3e91f5e444c48fbb | |
parent | 3eec5b9bee837e8a5454682902978ecfe5c1866d (diff) | |
parent | 6c6cd37f20ed5873555bd59563d67299078a4323 (diff) | |
download | libhidl-2efa586395d7a39364a080903f26a32ebbaadb13.tar.gz |
Merge cherrypicks of [13532551, 13532552, 13534990, 13533561, 13533870, 13533871, 13534991, 13533562, 13532553, 13533872, 13534992, 13532554, 13535065, 13535085, 13535105, 13535125, 13535126, 13535106, 13535107, 13535086] into rvc-qpr2-releaseandroid-11.0.0_r37android-11.0.0_r36android-11.0.0_r35android-11.0.0_r34android11-qpr2-release
Change-Id: I02599dc44549485b81711b20edff8e13b1b927e0
-rw-r--r-- | transport/ServiceManagement.cpp | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp index 7de5c78..a7e9626 100644 --- a/transport/ServiceManagement.cpp +++ b/transport/ServiceManagement.cpp @@ -153,42 +153,8 @@ __attribute__((noinline)) static void tryShortenProcessName(const std::string& d namespace details { -/* - * Returns the age of the current process by reading /proc/self/stat and comparing starttime to the - * current time. This is useful for measuring how long it took a HAL to register itself. - */ -__attribute__((noinline)) static long getProcessAgeMs() { - constexpr const int PROCFS_STAT_STARTTIME_INDEX = 21; - std::string content; - android::base::ReadFileToString("/proc/self/stat", &content, false); - auto stats = android::base::Split(content, " "); - if (stats.size() <= PROCFS_STAT_STARTTIME_INDEX) { - LOG(INFO) << "Could not read starttime from /proc/self/stat"; - return -1; - } - const std::string& startTimeString = stats[PROCFS_STAT_STARTTIME_INDEX]; - static const int64_t ticksPerSecond = sysconf(_SC_CLK_TCK); - const int64_t uptime = android::uptimeMillis(); - - unsigned long long startTimeInClockTicks = 0; - if (android::base::ParseUint(startTimeString, &startTimeInClockTicks)) { - long startTimeMs = 1000ULL * startTimeInClockTicks / ticksPerSecond; - return uptime - startTimeMs; - } - return -1; -} - static void onRegistrationImpl(const std::string& descriptor, const std::string& instanceName) { - long halStartDelay = getProcessAgeMs(); - if (halStartDelay >= 0) { - // The "start delay" printed here is an estimate of how long it took the HAL to go from - // process creation to registering itself as a HAL. Actual start time could be longer - // because the process might not have joined the threadpool yet, so it might not be ready to - // process transactions. - LOG(INFO) << "Registered " << descriptor << "/" << instanceName << " (start delay of " - << halStartDelay << "ms)"; - } - + LOG(INFO) << "Registered " << descriptor << "/" << instanceName; tryShortenProcessName(descriptor); } |