Files
ortools-clone/ortools/base/timer.cc

26 lines
877 B
C++
Raw Normal View History

// 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.
#include "ortools/base/timer.h"
2010-11-25 16:15:39 +00: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();
}