2021-04-01 21:00:53 +02:00
|
|
|
// Copyright 2010-2021 Google LLC
|
2010-11-25 16:15:39 +00:00
|
|
|
// 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.
|
|
|
|
|
|
2017-04-26 17:30:25 +02:00
|
|
|
#include "ortools/base/timer.h"
|
2010-11-25 16:15:39 +00:00
|
|
|
|
2020-10-28 13:42:36 +01:00
|
|
|
ScopedWallTime::ScopedWallTime(double* aggregate_time)
|
2014-01-08 12:01:58 +00:00
|
|
|
: aggregate_time_(aggregate_time), timer_() {
|
2022-02-15 17:57:52 +01:00
|
|
|
DCHECK(aggregate_time != nullptr);
|
2013-06-11 14:48:50 +00:00
|
|
|
timer_.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScopedWallTime::~ScopedWallTime() {
|
|
|
|
|
timer_.Stop();
|
|
|
|
|
*aggregate_time_ += timer_.Get();
|
|
|
|
|
}
|