Commit 003d0df8 authored by Jia's avatar Jia Committed by Commit Bot

[On-device adaptive brightness] Remove unnecessary logs

This cl cleans up logged messages that were intended for
model debugging. Now that the model is launched, we
can remove these messages and reduce spamming to the
logs.

Bug: 1148161
Change-Id: Iad9d202dde77ee5ca5662f6ac77494ea7e958ff3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2535894Reviewed-by: default avatarThanh Nguyen <thanhdng@chromium.org>
Commit-Queue: Jia Meng <jiameng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827118}
parent b5ce83db
...@@ -130,7 +130,6 @@ void Adapter::OnAmbientLightUpdated(int lux) { ...@@ -130,7 +130,6 @@ void Adapter::OnAmbientLightUpdated(int lux) {
} }
if (now - lid_reopen_time_ < lid_open_delay_time_) { if (now - lid_reopen_time_ < lid_open_delay_time_) {
VLOG(1) << "ABAdapter ALS ignored soon after lid-reopened";
return; return;
} }
...@@ -201,10 +200,6 @@ void Adapter::OnUserBrightnessChanged(double old_brightness_percent, ...@@ -201,10 +200,6 @@ void Adapter::OnUserBrightnessChanged(double old_brightness_percent,
const std::string log_als = const std::string log_als =
log_als_avg_stddev ? base::StringPrintf("%.4f", log_als_avg_stddev->avg) log_als_avg_stddev ? base::StringPrintf("%.4f", log_als_avg_stddev->avg)
: ""; : "";
VLOG(1) << "ABAdapter user brightness change: "
<< "brightness=" << FormatToPrint(old_brightness_percent) << "->"
<< FormatToPrint(new_brightness_percent) << " log_als=" << log_als;
OnBrightnessChanged( OnBrightnessChanged(
*first_recent_user_brightness_request_time, new_brightness_percent, *first_recent_user_brightness_request_time, new_brightness_percent,
log_als_avg_stddev ? base::Optional<double>(log_als_avg_stddev->avg) log_als_avg_stddev ? base::Optional<double>(log_als_avg_stddev->avg)
...@@ -262,7 +257,6 @@ void Adapter::OnModelTrained(const MonotoneCubicSpline& brightness_curve) { ...@@ -262,7 +257,6 @@ void Adapter::OnModelTrained(const MonotoneCubicSpline& brightness_curve) {
model_.personal_curve = brightness_curve; model_.personal_curve = brightness_curve;
++model_.iteration_count; ++model_.iteration_count;
new_model_arrived_ = true; new_model_arrived_ = true;
VLOG(1) << "ABAdapter new model arrived";
} }
void Adapter::OnModelInitialized(const Model& model) { void Adapter::OnModelInitialized(const Model& model) {
...@@ -301,9 +295,6 @@ void Adapter::SuspendDone(const base::TimeDelta& /* sleep_duration */) { ...@@ -301,9 +295,6 @@ void Adapter::SuspendDone(const base::TimeDelta& /* sleep_duration */) {
if (params_.user_adjustment_effect == UserAdjustmentEffect::kPauseAuto) if (params_.user_adjustment_effect == UserAdjustmentEffect::kPauseAuto)
adapter_disabled_by_user_adjustment_ = false; adapter_disabled_by_user_adjustment_ = false;
VLOG(1) << "ABAdapter suspend done with "
<< (new_model_arrived_ ? "new" : "no new") << " model";
} }
void Adapter::LidEventReceived(chromeos::PowerManagerClient::LidState state, void Adapter::LidEventReceived(chromeos::PowerManagerClient::LidState state,
...@@ -312,7 +303,6 @@ void Adapter::LidEventReceived(chromeos::PowerManagerClient::LidState state, ...@@ -312,7 +303,6 @@ void Adapter::LidEventReceived(chromeos::PowerManagerClient::LidState state,
if (!*is_lid_closed_) { if (!*is_lid_closed_) {
lid_reopen_time_ = tick_clock_->NowTicks(); lid_reopen_time_ = tick_clock_->NowTicks();
lid_closed_message_reported_ = false; lid_closed_message_reported_ = false;
VLOG(1) << "ABAdapter Adapter received lid-reopened event";
return; return;
} }
...@@ -440,8 +430,6 @@ void Adapter::InitParams(const ModelConfig& model_config) { ...@@ -440,8 +430,6 @@ void Adapter::InitParams(const ModelConfig& model_config) {
UMA_HISTOGRAM_ENUMERATION("AutoScreenBrightness.UserAdjustmentEffect", UMA_HISTOGRAM_ENUMERATION("AutoScreenBrightness.UserAdjustmentEffect",
params_.user_adjustment_effect); params_.user_adjustment_effect);
VLOG(1) << "ABAdapter user adjustment effect: "
<< static_cast<int>(params_.user_adjustment_effect);
} }
void Adapter::UpdateStatus() { void Adapter::UpdateStatus() {
...@@ -667,9 +655,6 @@ void Adapter::AdjustBrightness(BrightnessChangeCause cause, ...@@ -667,9 +655,6 @@ void Adapter::AdjustBrightness(BrightnessChangeCause cause,
const double brightness = GetBrightnessBasedOnAmbientLogLux(log_als_avg); const double brightness = GetBrightnessBasedOnAmbientLogLux(log_als_avg);
if (current_brightness_ && if (current_brightness_ &&
std::abs(brightness - *current_brightness_) < kTol) { std::abs(brightness - *current_brightness_) < kTol) {
VLOG(1) << "ABAdapter model brightness change canceled: "
<< "brightness=" << FormatToPrint(*current_brightness_) + "->"
<< FormatToPrint(brightness);
return; return;
} }
...@@ -709,12 +694,8 @@ double Adapter::GetBrightnessBasedOnAmbientLogLux( ...@@ -709,12 +694,8 @@ double Adapter::GetBrightnessBasedOnAmbientLogLux(
DCHECK_EQ(adapter_status_, Status::kSuccess); DCHECK_EQ(adapter_status_, Status::kSuccess);
// We use the latest curve available. // We use the latest curve available.
if (model_.personal_curve) { if (model_.personal_curve) {
VLOG(1) << "ABAdapter using personal curve for brightness change: \n"
<< model_.personal_curve->ToString();
return model_.personal_curve->Interpolate(ambient_log_lux); return model_.personal_curve->Interpolate(ambient_log_lux);
} }
VLOG(1) << "ABAdapter using global curve for brightness change: \n"
<< model_.global_curve->ToString();
return model_.global_curve->Interpolate(ambient_log_lux); return model_.global_curve->Interpolate(ambient_log_lux);
} }
......
...@@ -136,8 +136,6 @@ double BoundedBrightnessAdjustment(double brightness_old, ...@@ -136,8 +136,6 @@ double BoundedBrightnessAdjustment(double brightness_old,
is_user); is_user);
UMA_HISTOGRAM_ENUMERATION( UMA_HISTOGRAM_ENUMERATION(
"AutoScreenBrightness.ModelTraining.BrightnessChange", change); "AutoScreenBrightness.ModelTraining.BrightnessChange", change);
VLOG(1) << "ABTrainer bounded brightness change type: "
<< static_cast<int>(change);
return base::ClampToRange(brightness_new, lower_bound, upper_bound) - return base::ClampToRange(brightness_new, lower_bound, upper_bound) -
brightness_old; brightness_old;
...@@ -177,9 +175,6 @@ double ModelPredictionAdjustment(double brightness_old, ...@@ -177,9 +175,6 @@ double ModelPredictionAdjustment(double brightness_old,
// If model's prediction is consistent with user's selection, then no // If model's prediction is consistent with user's selection, then no
// brightness change will be necessary. // brightness change will be necessary.
if (is_consistent) { if (is_consistent) {
VLOG(1) << "ABTrainer model user brightness consistent (model,user): "
<< FormatToPrint(model_brightness - target_brightness) << ","
<< FormatToPrint(bounded_user_adjustment);
return 0.0; return 0.0;
} }
...@@ -203,8 +198,6 @@ void LogModelCurveError(double error, bool model_updated) { ...@@ -203,8 +198,6 @@ void LogModelCurveError(double error, bool model_updated) {
(model_updated ? "Update" : "NoUpdate"); (model_updated ? "Update" : "NoUpdate");
base::UmaHistogramPercentageObsoleteDoNotUse(histogram_name, base::UmaHistogramPercentageObsoleteDoNotUse(histogram_name,
std::round(error)); std::round(error));
VLOG(1) << "ABTrainer model error " << (model_updated ? "with " : "without ")
<< "model updated: " << FormatToPrint(error);
} }
} // namespace } // namespace
...@@ -421,8 +414,6 @@ TrainingResult GaussianTrainer::Train( ...@@ -421,8 +414,6 @@ TrainingResult GaussianTrainer::Train(
if (!need_to_update_curve_) { if (!need_to_update_curve_) {
const double error = CalculateCurveError(data); const double error = CalculateCurveError(data);
LogModelCurveError(error, false /* model_updated */); LogModelCurveError(error, false /* model_updated */);
VLOG(1) << "ABTrainer training finished without new curve: \n"
<< current_curve_->ToString();
return TrainingResult(base::nullopt, error); return TrainingResult(base::nullopt, error);
} }
...@@ -431,13 +422,10 @@ TrainingResult GaussianTrainer::Train( ...@@ -431,13 +422,10 @@ TrainingResult GaussianTrainer::Train(
const auto new_curve = MonotoneCubicSpline::CreateMonotoneCubicSpline( const auto new_curve = MonotoneCubicSpline::CreateMonotoneCubicSpline(
ambient_log_lux_, brightness_); ambient_log_lux_, brightness_);
if (!new_curve) { if (!new_curve) {
VLOG(1) << "ABTrainer training finished with new invalid curve";
return TrainingResult(base::nullopt, 0 /* error */); return TrainingResult(base::nullopt, 0 /* error */);
} }
current_curve_ = new_curve; current_curve_ = new_curve;
VLOG(1) << "ABTrainer training finished with new curve: \n"
<< current_curve_->ToString();
const double error = CalculateCurveError(data); const double error = CalculateCurveError(data);
LogModelCurveError(error, true /* model_updated */); LogModelCurveError(error, true /* model_updated */);
...@@ -463,11 +451,6 @@ void GaussianTrainer::AdjustCurveWithSingleDataPoint( ...@@ -463,11 +451,6 @@ void GaussianTrainer::AdjustCurveWithSingleDataPoint(
const double brightness_global = const double brightness_global =
global_curve_->Interpolate(data.ambient_log_lux); global_curve_->Interpolate(data.ambient_log_lux);
VLOG(1) << "ABTrainer training data point (global,old,new,log_lux): "
<< FormatToPrint(brightness_global) << ", "
<< FormatToPrint(data.brightness_old) << ", "
<< FormatToPrint(data.brightness_new) << ", " << data.ambient_log_lux;
// Check if this |data| is an outlier and should be ignored. It's an outlier // Check if this |data| is an outlier and should be ignored. It's an outlier
// if its original/old brightness is too far off from the brightness as // if its original/old brightness is too far off from the brightness as
// predicted by the global curve. This assumes the global curve is reasonably // predicted by the global curve. This assumes the global curve is reasonably
...@@ -478,9 +461,6 @@ void GaussianTrainer::AdjustCurveWithSingleDataPoint( ...@@ -478,9 +461,6 @@ void GaussianTrainer::AdjustCurveWithSingleDataPoint(
is_brightness_outlier); is_brightness_outlier);
if (is_brightness_outlier) { if (is_brightness_outlier) {
VLOG(1) << "ABTrainer outlier (user,global): "
<< FormatToPrint(data.brightness_old) << ","
<< FormatToPrint(brightness_global);
return; return;
} }
...@@ -527,8 +507,6 @@ void GaussianTrainer::EnforceMonotonicity(size_t center_index) { ...@@ -527,8 +507,6 @@ void GaussianTrainer::EnforceMonotonicity(size_t center_index) {
brightness_[i - 1] = brightness_[i - 1] =
base::ClampToRange(brightness_[i - 1], min_value, max_value); base::ClampToRange(brightness_[i - 1], min_value, max_value);
if (brightness_[i - 1] > 100.0) { if (brightness_[i - 1] > 100.0) {
VLOG(1) << "ABTrainer exceeded max at " << (i - 1)
<< " with value: " << FormatToPrint(brightness_[i - 1]);
brightness_[i - 1] = 100.0; brightness_[i - 1] = 100.0;
} }
} }
...@@ -541,8 +519,6 @@ void GaussianTrainer::EnforceMonotonicity(size_t center_index) { ...@@ -541,8 +519,6 @@ void GaussianTrainer::EnforceMonotonicity(size_t center_index) {
brightness_[i + 1] = brightness_[i + 1] =
base::ClampToRange(brightness_[i + 1], min_value, max_value); base::ClampToRange(brightness_[i + 1], min_value, max_value);
if (brightness_[i + 1] > 100.0) { if (brightness_[i + 1] > 100.0) {
VLOG(1) << "ABTrainer exceeded max at " << (i + 1)
<< " with value: " << FormatToPrint(brightness_[i + 1]);
brightness_[i + 1] = 100.0; brightness_[i + 1] = 100.0;
} }
} }
......
...@@ -32,7 +32,6 @@ enum class InvalidCurveReason { ...@@ -32,7 +32,6 @@ enum class InvalidCurveReason {
void LogError(InvalidCurveReason reason) { void LogError(InvalidCurveReason reason) {
base::UmaHistogramEnumeration("AutoScreenBrightness.InvalidCurveReason", base::UmaHistogramEnumeration("AutoScreenBrightness.InvalidCurveReason",
reason); reason);
VLOG(1) << "ABCurve invalid curve: " << static_cast<int>(reason);
} }
bool IsIncreasing(const std::vector<double>& data, bool is_strict) { bool IsIncreasing(const std::vector<double>& data, bool is_strict) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment