2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __DIAG_THREAD_H__
18 #define __DIAG_THREAD_H__
20 #include <utils/List.h>
21 #include <utils/threads.h>
28 class DiagThread : public Thread {
30 DiagThread(CommonClock* common_clock, LocalClock* local_clock);
33 status_t startWorkThread();
34 void stopWorkThread();
35 virtual bool threadLoop();
37 void pushDisciplineEvent(int64_t observed_local_time,
38 int64_t observed_common_time,
39 int64_t nominal_common_time,
40 int32_t total_correction,
46 int64_t action_local_time;
47 int64_t action_common_time;
48 int64_t observed_local_time;
49 int64_t observed_common_time;
50 int64_t nominal_common_time;
51 int32_t total_correction;
53 } DisciplineEventRecord;
55 bool openListenSocket();
56 void cleanupListenSocket();
57 void cleanupDataSocket();
60 CommonClock* common_clock_;
61 LocalClock* local_clock_;
65 int64_t kernel_logID_basis_;
66 bool kernel_logID_basis_known_;
68 static const size_t kMaxDisciplineLogSize = 16;
69 Mutex discipline_log_lock_;
70 List<DisciplineEventRecord> discipline_log_;
71 int64_t discipline_log_ID_;
74 } // namespace android
76 #endif //__ DIAG_THREAD_H__