diff options
author | 2009-06-01 13:55:28 -0700 | |
---|---|---|
committer | 2009-06-01 13:55:28 -0700 | |
commit | 294423e148c62b413788945be00cedde3cb3acec (patch) | |
tree | 1f4cc3035a7ee6aa1c73b12d440aa5568f800638 | |
parent | 3b7294521fae1a3075a112e0e3bd315cfe0155df (diff) |
get rid of TimerProbe which is never used
-rw-r--r-- | include/utils/TimerProbe.h | 72 | ||||
-rw-r--r-- | libs/utils/Android.mk | 1 | ||||
-rw-r--r-- | libs/utils/TimerProbe.cpp | 131 |
3 files changed, 0 insertions, 204 deletions
diff --git a/include/utils/TimerProbe.h b/include/utils/TimerProbe.h deleted file mode 100644 index f2e32b21a5..0000000000 --- a/include/utils/TimerProbe.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_TIMER_PROBE_H -#define ANDROID_TIMER_PROBE_H - -#if 0 && defined(HAVE_POSIX_CLOCKS) -#define ENABLE_TIMER_PROBE 1 -#else -#define ENABLE_TIMER_PROBE 0 -#endif - -#if ENABLE_TIMER_PROBE - -#include <time.h> -#include <sys/time.h> -#include <utils/Vector.h> - -#define TIMER_PROBE(tag) \ - static int _timer_slot_; \ - android::TimerProbe probe(tag, &_timer_slot_) -#define TIMER_PROBE_END() probe.end() -#else -#define TIMER_PROBE(tag) -#define TIMER_PROBE_END() -#endif - -#if ENABLE_TIMER_PROBE -namespace android { - -class TimerProbe { -public: - TimerProbe(const char tag[], int* slot); - void end(); - ~TimerProbe(); -private: - struct Bucket { - int mStart, mReal, mProcess, mThread, mCount; - const char* mTag; - int* mSlotPtr; - int mIndent; - }; - static Vector<Bucket> gBuckets; - static TimerProbe* gExecuteChain; - static int gIndent; - static timespec gRealBase; - TimerProbe* mNext; - static uint32_t ElapsedTime(const timespec& start, const timespec& end); - void print(const timespec& r, const timespec& p, const timespec& t) const; - timespec mRealStart, mPStart, mTStart; - const char* mTag; - int mIndent; - int mBucket; -}; - -}; // namespace android - -#endif -#endif diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk index 00395f69c0..1acc1a43aa 100644 --- a/libs/utils/Android.mk +++ b/libs/utils/Android.mk @@ -35,7 +35,6 @@ commonSources:= \ SystemClock.cpp \ TextOutput.cpp \ Threads.cpp \ - TimerProbe.cpp \ Timers.cpp \ VectorImpl.cpp \ ZipFileCRO.cpp \ diff --git a/libs/utils/TimerProbe.cpp b/libs/utils/TimerProbe.cpp deleted file mode 100644 index 835480d366..0000000000 --- a/libs/utils/TimerProbe.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <utils/TimerProbe.h> - -#if ENABLE_TIMER_PROBE - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "time" - -namespace android { - -Vector<TimerProbe::Bucket> TimerProbe::gBuckets; -TimerProbe* TimerProbe::gExecuteChain; -int TimerProbe::gIndent; -timespec TimerProbe::gRealBase; - -TimerProbe::TimerProbe(const char tag[], int* slot) : mTag(tag) -{ - mNext = gExecuteChain; - gExecuteChain = this; - mIndent = gIndent; - gIndent += 1; - if (mIndent > 0) { - if (*slot == 0) { - int count = gBuckets.add(); - *slot = count; - Bucket& bucket = gBuckets.editItemAt(count); - memset(&bucket, 0, sizeof(Bucket)); - bucket.mTag = tag; - bucket.mSlotPtr = slot; - bucket.mIndent = mIndent; - } - mBucket = *slot; - } - clock_gettime(CLOCK_REALTIME, &mRealStart); - if (gRealBase.tv_sec == 0) - gRealBase = mRealStart; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &mPStart); - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &mTStart); -} - -void TimerProbe::end() -{ - timespec realEnd, pEnd, tEnd; - clock_gettime(CLOCK_REALTIME, &realEnd); - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &pEnd); - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tEnd); - print(realEnd, pEnd, tEnd); - mTag = NULL; -} - -TimerProbe::~TimerProbe() -{ - if (mTag != NULL) - end(); - gExecuteChain = mNext; - gIndent--; -} - - -uint32_t TimerProbe::ElapsedTime(const timespec& start, const timespec& end) -{ - int sec = end.tv_sec - start.tv_sec; - int nsec = end.tv_nsec - start.tv_nsec; - if (nsec < 0) { - sec--; - nsec += 1000000000; - } - return sec * 1000000 + nsec / 1000; -} - -void TimerProbe::print(const timespec& r, const timespec& p, - const timespec& t) const -{ - uint32_t es = ElapsedTime(gRealBase, mRealStart); - uint32_t er = ElapsedTime(mRealStart, r); - uint32_t ep = ElapsedTime(mPStart, p); - uint32_t et = ElapsedTime(mTStart, t); - if (mIndent > 0) { - Bucket& bucket = gBuckets.editItemAt(mBucket); - if (bucket.mStart == 0) - bucket.mStart = es; - bucket.mReal += er; - bucket.mProcess += ep; - bucket.mThread += et; - bucket.mCount++; - return; - } - int index = 0; - int buckets = gBuckets.size(); - int count = 1; - const char* tag = mTag; - int indent = mIndent; - do { - LOGD("%-30.30s: (%3d) %-5.*s time=%-10.3f real=%7dus process=%7dus (%3d%%) thread=%7dus (%3d%%)\n", - tag, count, indent > 5 ? 5 : indent, "+++++", es / 1000000.0, - er, ep, ep * 100 / er, et, et * 100 / er); - if (index >= buckets) - break; - Bucket& bucket = gBuckets.editItemAt(index); - count = bucket.mCount; - es = bucket.mStart; - er = bucket.mReal; - ep = bucket.mProcess; - et = bucket.mThread; - tag = bucket.mTag; - indent = bucket.mIndent; - *bucket.mSlotPtr = 0; - } while (++index); // always true - gBuckets.clear(); -} - -}; // namespace android - -#endif |