Merge "Frameworks/base: Wall Werror in common_time"
This commit is contained in:
@@ -33,4 +33,6 @@ LOCAL_SHARED_LIBRARIES := \
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := common_time
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#define LOG_TAG "common_time"
|
||||
#include <utils/Log.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <common_time/local_clock.h>
|
||||
@@ -280,7 +281,7 @@ bool ClockRecoveryLoop::pushDisciplineEvent(int64_t local_time,
|
||||
// system.
|
||||
setTargetCorrection_l(tgt_correction);
|
||||
|
||||
LOG_TS("clock_loop %lld %f %f %f %d\n", raw_delta, delta_f, CO, CObias, tgt_correction);
|
||||
LOG_TS("clock_loop %" PRId64 " %f %f %f %d\n", raw_delta, delta_f, CO, CObias, tgt_correction);
|
||||
|
||||
#ifdef TIME_SERVICE_DEBUG
|
||||
diag_thread_->pushDisciplineEvent(
|
||||
@@ -335,7 +336,6 @@ void ClockRecoveryLoop::setTargetCorrection_l(int32_t tgt) {
|
||||
// 300mSec.
|
||||
if (tgt_correction_ != tgt) {
|
||||
int64_t now = local_clock_->getLocalTime();
|
||||
status_t res;
|
||||
|
||||
tgt_correction_ = tgt;
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ class ClockRecoveryLoop {
|
||||
bool last_error_est_valid_;
|
||||
int32_t last_error_est_usec_;
|
||||
float last_delta_f_;
|
||||
int32_t integrated_error_;
|
||||
int32_t tgt_correction_;
|
||||
int32_t cur_correction_;
|
||||
LinearTransform time_to_cur_slew_;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define LOG_TAG "common_time"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utils/Errors.h>
|
||||
@@ -50,7 +51,7 @@ bool CommonClock::init(uint64_t local_freq) {
|
||||
|
||||
LinearTransform::reduce(&numer, &denom);
|
||||
if ((numer > UINT32_MAX) || (denom > UINT32_MAX)) {
|
||||
ALOGE("Overflow in CommonClock::init while trying to reduce %lld/%lld",
|
||||
ALOGE("Overflow in CommonClock::init while trying to reduce %" PRIu64 "/%" PRIu64,
|
||||
kCommonFreq, local_freq);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
@@ -969,13 +970,14 @@ bool CommonTimeServer::handleSyncResponse(
|
||||
// if the RTT of the packet is significantly larger than the panic
|
||||
// threshold, we should simply discard it. Its better to do nothing
|
||||
// than to take cues from a packet like that.
|
||||
int rttCommon = mCommonClock.localDurationToCommonDuration(rtt);
|
||||
int64_t rttCommon = mCommonClock.localDurationToCommonDuration(rtt);
|
||||
if (rttCommon > (static_cast<int64_t>(mPanicThresholdUsec) *
|
||||
kRTTDiscardPanicThreshMultiplier)) {
|
||||
ALOGV("Dropping sync response with RTT of %lld uSec", rttCommon);
|
||||
ALOGV("Dropping sync response with RTT of %" PRId64 " uSec", rttCommon);
|
||||
mClient_ExpiredSyncRespsRXedFromCurMaster++;
|
||||
if (shouldPanicNotGettingGoodData())
|
||||
return becomeInitial("RX panic, no good data");
|
||||
return true;
|
||||
} else {
|
||||
result = mClockRecovery.pushDisciplineEvent(avgLocal, avgCommon, rttCommon);
|
||||
mClient_LastGoodSyncRX = clientRxLocalTime;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "common_time_server.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
//
|
||||
@@ -286,7 +288,7 @@ void CommonTimeServer::reevaluateAutoDisableState(bool commonClockHasClients) {
|
||||
#define checked_percentage(a, b) ((0 == b) ? 0.0f : ((100.0f * a) / b))
|
||||
|
||||
status_t CommonTimeServer::dumpClockInterface(int fd,
|
||||
const Vector<String16>& args,
|
||||
const Vector<String16>& /* args */,
|
||||
size_t activeClients) {
|
||||
AutoMutex _lock(&mLock);
|
||||
const size_t SIZE = 256;
|
||||
@@ -308,15 +310,15 @@ status_t CommonTimeServer::dumpClockInterface(int fd,
|
||||
synced = (OK == mCommonClock.localToCommon(localTime, &commonTime));
|
||||
sockaddrToString(mMasterEP, mMasterEPValid, maStr, sizeof(maStr));
|
||||
|
||||
dump_printf("Common Clock Service Status\nLocal time : %lld\n",
|
||||
dump_printf("Common Clock Service Status\nLocal time : %" PRId64 "\n",
|
||||
localTime);
|
||||
|
||||
if (synced)
|
||||
dump_printf("Common time : %lld\n", commonTime);
|
||||
dump_printf("Common time : %" PRId64 "\n", commonTime);
|
||||
else
|
||||
dump_printf("Common time : %s\n", "not synced");
|
||||
|
||||
dump_printf("Timeline ID : %016llx\n", mTimelineID);
|
||||
dump_printf("Timeline ID : %016" PRIu64 "\n", mTimelineID);
|
||||
dump_printf("State : %s\n", stateToString(mState));
|
||||
dump_printf("Master Addr : %s\n", maStr);
|
||||
|
||||
@@ -349,10 +351,10 @@ status_t CommonTimeServer::dumpClockInterface(int fd,
|
||||
int64_t localDelta, usecDelta;
|
||||
localDelta = localTime - mClient_LastGoodSyncRX;
|
||||
usecDelta = mCommonClock.localDurationToCommonDuration(localDelta);
|
||||
dump_printf("Last Good RX : %lld uSec ago\n", usecDelta);
|
||||
dump_printf("Last Good RX : %" PRId64 " uSec ago\n", usecDelta);
|
||||
}
|
||||
|
||||
dump_printf("Active Clients : %u\n", activeClients);
|
||||
dump_printf("Active Clients : %zu\n", activeClients);
|
||||
mClient_PacketRTTLog.dumpLog(fd, mCommonClock);
|
||||
mStateChangeLog.dumpLog(fd);
|
||||
mElectionLog.dumpLog(fd);
|
||||
@@ -363,7 +365,7 @@ status_t CommonTimeServer::dumpClockInterface(int fd,
|
||||
}
|
||||
|
||||
status_t CommonTimeServer::dumpConfigInterface(int fd,
|
||||
const Vector<String16>& args) {
|
||||
const Vector<String16>& /* args */) {
|
||||
AutoMutex _lock(&mLock);
|
||||
const size_t SIZE = 256;
|
||||
char buffer[SIZE];
|
||||
@@ -383,7 +385,7 @@ status_t CommonTimeServer::dumpConfigInterface(int fd,
|
||||
"Bound Interface : %s\n",
|
||||
mBindIfaceValid ? mBindIface.string() : "<unbound>");
|
||||
dump_printf("Master Election Endpoint : %s\n", meStr);
|
||||
dump_printf("Master Election Group ID : %016llx\n", mSyncGroupID);
|
||||
dump_printf("Master Election Group ID : %016" PRIu64 "\n", mSyncGroupID);
|
||||
dump_printf("Master Announce Interval : %d mSec\n",
|
||||
mMasterAnnounceIntervalMs);
|
||||
dump_printf("Client Sync Interval : %d mSec\n",
|
||||
@@ -419,12 +421,12 @@ void CommonTimeServer::PacketRTTLog::dumpLog(int fd, const CommonClock& cclk) {
|
||||
if (rxTimes[i]) {
|
||||
int64_t delta = rxTimes[i] - txTimes[i];
|
||||
int64_t deltaUsec = cclk.localDurationToCommonDuration(delta);
|
||||
dump_printf("pkt[%2d] : localTX %12lld localRX %12lld "
|
||||
dump_printf("pkt[%2d] : localTX %12" PRId64 " localRX %12" PRId64 " "
|
||||
"(%.3f msec RTT)\n",
|
||||
ndx, txTimes[i], rxTimes[i],
|
||||
static_cast<float>(deltaUsec) / 1000.0);
|
||||
} else {
|
||||
dump_printf("pkt[%2d] : localTX %12lld localRX never\n",
|
||||
dump_printf("pkt[%2d] : localTX %12" PRId64 " localRX never\n",
|
||||
ndx, txTimes[i]);
|
||||
}
|
||||
i = (i + 1) % RTT_LOG_SIZE;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "common_time_server.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main() {
|
||||
using namespace android;
|
||||
|
||||
sp<CommonTimeServer> service = new CommonTimeServer();
|
||||
|
||||
Reference in New Issue
Block a user