523 lines
93 KiB
HTML
523 lines
93 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>OR-Tools</title>
|
|
<meta http-equiv="Content-Type" content="text/html;"/>
|
|
<meta charset="utf-8"/>
|
|
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="styleSheet.tmp.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<div id="banner-container">
|
|
<div id="banner">
|
|
<span id="sfml">Google OR-Tools 9.3</span>
|
|
</div>
|
|
</div>
|
|
<div id="content" style="width: 100%; overflow: hidden;">
|
|
<div style="margin-left: 15px; margin-top: 5px; float: left; color: #145A32;">
|
|
<h2>C++ Reference</h2>
|
|
<ul>
|
|
<li><a href="../cpp_algorithms/annotated.html">Algorithms</a></li>
|
|
<li><a href="../cpp_sat/annotated.html">CP-SAT</a></li>
|
|
<li><a href="../cpp_graph/annotated.html">Graph</a></li>
|
|
<li><a href="../cpp_routing/annotated.html">Routing</a></li>
|
|
<li><a href="../cpp_linear/annotated.html">Linear solver</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="content">
|
|
<div align="center">
|
|
<h1 style="color: #145A32;">C++ Reference: CP-SAT</h1>
|
|
</div>
|
|
<!-- Generated by Doxygen 1.9.3 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function(){initNavTree('time__limit_8h_source.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="headertitle"><div class="title">time_limit.h</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="time__limit_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">// Copyright 2010-2021 Google LLC</span></div>
|
|
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div>
|
|
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment">// you may not use this file except in compliance with the License.</span></div>
|
|
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="comment">// You may obtain a copy of the License at</span></div>
|
|
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="comment">//</span></div>
|
|
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
|
|
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="comment">//</span></div>
|
|
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div>
|
|
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
|
|
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="comment">// See the License for the specific language governing permissions and</span></div>
|
|
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="comment">// limitations under the License.</span></div>
|
|
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
|
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#ifndef OR_TOOLS_UTIL_TIME_LIMIT_H_</span></div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#define OR_TOOLS_UTIL_TIME_LIMIT_H_</span></div>
|
|
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
|
|
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include <algorithm></span></div>
|
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include <atomic></span></div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include <cstdlib></span></div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include <limits></span></div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include <memory></span></div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include <string></span></div>
|
|
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
|
|
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#include "absl/base/port.h"</span></div>
|
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#include "absl/container/flat_hash_map.h"</span></div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="preprocessor">#include "absl/memory/memory.h"</span></div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="preprocessor">#include "absl/synchronization/mutex.h"</span></div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="preprocessor">#include "absl/time/clock.h"</span></div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="preprocessor">#include "ortools/base/commandlineflags.h"</span></div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="preprocessor">#include "ortools/base/logging.h"</span></div>
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="preprocessor">#include "ortools/base/macros.h"</span></div>
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="preprocessor">#include "ortools/base/timer.h"</span></div>
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span><span class="preprocessor">#include "ortools/util/running_stat.h"</span></div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span><span class="preprocessor">#ifdef HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="preprocessor">#include "exegesis/exegesis/itineraries/perf_subsystem.h"</span></div>
|
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="preprocessor">#endif </span><span class="comment">// HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="time__limit_8h.html#aeebe51fb8b5872f6c2e4d01a04af8f78"> 42</a></span><a class="code hl_function" href="time__limit_8h.html#aeebe51fb8b5872f6c2e4d01a04af8f78">ABSL_DECLARE_FLAG</a>(<span class="keywordtype">bool</span>, time_limit_use_usertime);</div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="time__limit_8h.html#a1c1600c80c38555c75d29c319ec767ed"> 48</a></span><a class="code hl_function" href="time__limit_8h.html#aeebe51fb8b5872f6c2e4d01a04af8f78">ABSL_DECLARE_FLAG</a>(<span class="keywordtype">bool</span>, time_limit_use_instruction_count);</div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespaceoperations__research.html">operations_research</a> {</div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span><span class="comment">// TODO(user): The expression "deterministic time" should be replaced with</span></div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span><span class="comment">// "number of operations" to avoid confusion with "real" time.</span></div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html"> 106</a></span><span class="keyword">class </span><a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a> {</div>
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keyword">public</span>:</div>
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a1837453fa693143e6ec334701557a448"> 108</a></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classoperations__research_1_1_time_limit.html#a1837453fa693143e6ec334701557a448">kSafetyBufferSeconds</a>; <span class="comment">// See the .cc for the value.</span></div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ac62fbbc5383a86a9fe334e3213f6244b"> 109</a></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code hl_variable" href="classoperations__research_1_1_time_limit.html#ac62fbbc5383a86a9fe334e3213f6244b">kHistorySize</a>;</div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keyword">explicit</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a0598aaf87dab140f870c8ada2a1f3a39">TimeLimit</a>(</div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordtype">double</span> limit_in_seconds,</div>
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordtype">double</span> deterministic_limit = std::numeric_limits<double>::infinity(),</div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="keywordtype">double</span> instruction_limit = std::numeric_limits<double>::infinity());</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a0598aaf87dab140f870c8ada2a1f3a39"> 127</a></span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a0598aaf87dab140f870c8ada2a1f3a39">TimeLimit</a>() : <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>(std::numeric_limits<double>::infinity()) {}</div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ac056854a98f4094ef4c8d3858b955fef"> 128</a></span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ac056854a98f4094ef4c8d3858b955fef">TimeLimit</a>(<span class="keyword">const</span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>&) = <span class="keyword">delete</span>;</div>
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ad184e7d5cf6d68a6d9b2d32c8dc30c06"> 129</a></span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>& <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ad184e7d5cf6d68a6d9b2d32c8dc30c06">operator=</a>(<span class="keyword">const</span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>&) = <span class="keyword">delete</span>;</div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> </div>
|
|
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a8e8e386d8f916b1fefb983118cbdf0a6"> 135</a></span> <span class="keyword">static</span> std::unique_ptr<TimeLimit> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a8e8e386d8f916b1fefb983118cbdf0a6">Infinite</a>() {</div>
|
|
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="keywordflow">return</span> absl::make_unique<TimeLimit>(</div>
|
|
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> std::numeric_limits<double>::infinity(),</div>
|
|
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> std::numeric_limits<double>::infinity(),</div>
|
|
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> std::numeric_limits<double>::infinity());</div>
|
|
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> }</div>
|
|
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
|
|
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a905ec35ba16ac082d3528cf4b6ea9658"> 145</a></span> <span class="keyword">static</span> std::unique_ptr<TimeLimit> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a905ec35ba16ac082d3528cf4b6ea9658">FromDeterministicTime</a>(</div>
|
|
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="keywordtype">double</span> deterministic_limit) {</div>
|
|
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keywordflow">return</span> absl::make_unique<TimeLimit>(</div>
|
|
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> std::numeric_limits<double>::infinity(), deterministic_limit,</div>
|
|
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> std::numeric_limits<double>::infinity());</div>
|
|
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> }</div>
|
|
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> </div>
|
|
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="comment">// TODO(user): Support adding instruction count limit from parameters.</span></div>
|
|
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keyword">template</span> <<span class="keyword">typename</span> Parameters></div>
|
|
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a0ea9620e492bd75ea7e2fcded8f1de8b"> 160</a></span> <span class="keyword">static</span> std::unique_ptr<TimeLimit> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a0ea9620e492bd75ea7e2fcded8f1de8b">FromParameters</a>(</div>
|
|
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <span class="keyword">const</span> Parameters& parameters) {</div>
|
|
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="keywordflow">return</span> absl::make_unique<TimeLimit>(</div>
|
|
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> parameters.max_time_in_seconds(), parameters.max_deterministic_time(),</div>
|
|
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> std::numeric_limits<double>::infinity());</div>
|
|
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> }</div>
|
|
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> </div>
|
|
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a43229b9a540c5b4c3751ebb13e73ace8"> 172</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a43229b9a540c5b4c3751ebb13e73ace8">SetInstructionLimit</a>(<span class="keywordtype">double</span> instruction_limit) {</div>
|
|
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> instruction_limit_ = instruction_limit;</div>
|
|
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> }</div>
|
|
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> </div>
|
|
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="comment">// TODO(user): Use an exact counter for counting instructions. The</span></div>
|
|
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <span class="comment">// PMU counter returns the instruction count value as double since there may</span></div>
|
|
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="comment">// be sampling issues.</span></div>
|
|
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4cb3517d59bf4642a85294267736af20">ReadInstructionCounter</a>();</div>
|
|
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> </div>
|
|
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a810d5f7aaf80cc09cf5a094e20c1aaca">LimitReached</a>();</div>
|
|
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> </div>
|
|
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">GetTimeLeft</a>() <span class="keyword">const</span>;</div>
|
|
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> </div>
|
|
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a362a88bfe50d83c028154a62ef53e780"> 213</a></span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a362a88bfe50d83c028154a62ef53e780">GetDeterministicTimeLeft</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordflow">return</span> std::max(0.0, deterministic_limit_ - elapsed_deterministic_time_);</div>
|
|
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> }</div>
|
|
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> </div>
|
|
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a0be73bea3d751ca2926c1cd616abb31e">GetInstructionsLeft</a>();</div>
|
|
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> </div>
|
|
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9"> 227</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9">AdvanceDeterministicTime</a>(<span class="keywordtype">double</span> deterministic_duration) {</div>
|
|
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> DCHECK_LE(0.0, deterministic_duration);</div>
|
|
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> elapsed_deterministic_time_ += deterministic_duration;</div>
|
|
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> }</div>
|
|
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> </div>
|
|
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ad068edb54c705c548c20e4ba47b4e3a8"> 241</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ad068edb54c705c548c20e4ba47b4e3a8">AdvanceDeterministicTime</a>(<span class="keywordtype">double</span> deterministic_duration,</div>
|
|
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* counter_name) {</div>
|
|
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9">AdvanceDeterministicTime</a>(deterministic_duration);</div>
|
|
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span><span class="preprocessor">#ifndef NDEBUG</span></div>
|
|
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> deterministic_counters_[counter_name] += deterministic_duration;</div>
|
|
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span><span class="preprocessor">#endif</span></div>
|
|
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> }</div>
|
|
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> </div>
|
|
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ae3fe2e2b613455b49c6cc74dd3c7581e"> 252</a></span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ae3fe2e2b613455b49c6cc74dd3c7581e">GetElapsedTime</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> <span class="keywordflow">return</span> 1e-9 * (absl::GetCurrentTimeNanos() - start_ns_);</div>
|
|
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> }</div>
|
|
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> </div>
|
|
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ac7e861414a70fc937d18bc7ca743fc98"> 261</a></span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ac7e861414a70fc937d18bc7ca743fc98">GetElapsedDeterministicTime</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> <span class="keywordflow">return</span> elapsed_deterministic_time_;</div>
|
|
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> }</div>
|
|
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> </div>
|
|
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a5b6cf15a55615535aa54e71103de8d9f"> 274</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a5b6cf15a55615535aa54e71103de8d9f">RegisterExternalBooleanAsLimit</a>(</div>
|
|
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> std::atomic<bool>* external_boolean_as_limit) {</div>
|
|
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> external_boolean_as_limit_ = external_boolean_as_limit;</div>
|
|
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> }</div>
|
|
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> </div>
|
|
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a4747b1676f59ae0ccca60bb4c414de08"> 282</a></span> std::atomic<bool>* <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4747b1676f59ae0ccca60bb4c414de08">ExternalBooleanAsLimit</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> <span class="keywordflow">return</span> external_boolean_as_limit_;</div>
|
|
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno"> 284</span> }</div>
|
|
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span> </div>
|
|
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span> <span class="keyword">template</span> <<span class="keyword">typename</span> Parameters></div>
|
|
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a312550ebabce586fb77c49e813c610f8">ResetLimitFromParameters</a>(<span class="keyword">const</span> Parameters& parameters);</div>
|
|
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ad0cdf04d71ac4f14262eb4871041ddbd">MergeWithGlobalTimeLimit</a>(<a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* other);</div>
|
|
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> </div>
|
|
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#af6b375b546e563ed7e6312123ce9c7a0"> 297</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#af6b375b546e563ed7e6312123ce9c7a0">ChangeDeterministicLimit</a>(<span class="keywordtype">double</span> new_limit) {</div>
|
|
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> deterministic_limit_ = new_limit;</div>
|
|
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> }</div>
|
|
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> </div>
|
|
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a75214ecbf18d3e29566c78cac35f699b"> 304</a></span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a75214ecbf18d3e29566c78cac35f699b">GetDeterministicLimit</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> deterministic_limit_; }</div>
|
|
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> </div>
|
|
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a764be64f3029f8b8e23511061d8de355"> 309</a></span> std::string <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a764be64f3029f8b8e23511061d8de355">DebugString</a>() <span class="keyword">const</span>;</div>
|
|
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span> </div>
|
|
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno"> 311</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno"> 312</span> <span class="keywordtype">void</span> ResetTimers(<span class="keywordtype">double</span> limit_in_seconds, <span class="keywordtype">double</span> deterministic_limit,</div>
|
|
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno"> 313</span> <span class="keywordtype">double</span> instruction_limit);</div>
|
|
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> </div>
|
|
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> std::string GetInstructionRetiredEventName()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span> <span class="keywordflow">return</span> <span class="stringliteral">"inst_retired:any_p:u"</span>;</div>
|
|
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"> 317</span> }</div>
|
|
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno"> 318</span> </div>
|
|
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno"> 319</span> <span class="keyword">mutable</span> int64_t start_ns_; <span class="comment">// Not const! this is initialized after</span></div>
|
|
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno"> 320</span> <span class="comment">// instruction counter initialization.</span></div>
|
|
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno"> 321</span> int64_t last_ns_;</div>
|
|
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> int64_t limit_ns_; <span class="comment">// Not const! See the code of LimitReached().</span></div>
|
|
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno"> 323</span> <span class="keyword">const</span> int64_t safety_buffer_ns_;</div>
|
|
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> RunningMax<int64_t> running_max_;</div>
|
|
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno"> 325</span> </div>
|
|
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno"> 326</span> <span class="comment">// Only used when FLAGS_time_limit_use_usertime is true.</span></div>
|
|
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> UserTimer user_timer_;</div>
|
|
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno"> 328</span> <span class="keywordtype">double</span> limit_in_seconds_;</div>
|
|
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno"> 329</span> </div>
|
|
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno"> 330</span> <span class="keywordtype">double</span> deterministic_limit_;</div>
|
|
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno"> 331</span> <span class="keywordtype">double</span> elapsed_deterministic_time_;</div>
|
|
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno"> 332</span> </div>
|
|
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno"> 333</span> std::atomic<bool>* external_boolean_as_limit_;</div>
|
|
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno"> 334</span> </div>
|
|
<div class="line"><a id="l00335" name="l00335"></a><span class="lineno"> 335</span><span class="preprocessor">#ifdef HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00336" name="l00336"></a><span class="lineno"> 336</span> <span class="comment">// PMU counter to help count the instructions.</span></div>
|
|
<div class="line"><a id="l00337" name="l00337"></a><span class="lineno"> 337</span> exegesis::PerfSubsystem perf_subsystem_;</div>
|
|
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno"> 338</span><span class="preprocessor">#endif </span><span class="comment">// HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00339" name="l00339"></a><span class="lineno"> 339</span> <span class="comment">// Given limit in terms of number of instructions.</span></div>
|
|
<div class="line"><a id="l00340" name="l00340"></a><span class="lineno"> 340</span> <span class="keywordtype">double</span> instruction_limit_;</div>
|
|
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno"> 341</span> </div>
|
|
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno"> 342</span><span class="preprocessor">#ifndef NDEBUG</span></div>
|
|
<div class="line"><a id="l00343" name="l00343"></a><span class="lineno"> 343</span> <span class="comment">// Contains the values of the deterministic time counters.</span></div>
|
|
<div class="line"><a id="l00344" name="l00344"></a><span class="lineno"> 344</span> absl::flat_hash_map<std::string, double> deterministic_counters_;</div>
|
|
<div class="line"><a id="l00345" name="l00345"></a><span class="lineno"> 345</span><span class="preprocessor">#endif</span></div>
|
|
<div class="line"><a id="l00346" name="l00346"></a><span class="lineno"> 346</span> </div>
|
|
<div class="line"><a id="l00347" name="l00347"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a80c2662c13e3bbf165ffe1603fe87433"> 347</a></span> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code hl_class" href="classoperations__research_1_1_nested_time_limit.html">NestedTimeLimit</a>;</div>
|
|
<div class="line"><a id="l00348" name="l00348"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a4c1bbdcb2a449b42a788178d2c3d2477"> 348</a></span> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code hl_friend" href="classoperations__research_1_1_time_limit.html#a4c1bbdcb2a449b42a788178d2c3d2477">ParallelTimeLimit</a>;</div>
|
|
<div class="line"><a id="l00349" name="l00349"></a><span class="lineno"> 349</span>};</div>
|
|
<div class="line"><a id="l00350" name="l00350"></a><span class="lineno"> 350</span> </div>
|
|
<div class="line"><a id="l00351" name="l00351"></a><span class="lineno"> 351</span><span class="comment">// Wrapper around TimeLimit to make it thread safe and add Stop() support.</span></div>
|
|
<div class="line"><a id="l00352" name="l00352"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html"> 352</a></span><span class="keyword">class </span><a class="code hl_class" href="classoperations__research_1_1_shared_time_limit.html">SharedTimeLimit</a> {</div>
|
|
<div class="line"><a id="l00353" name="l00353"></a><span class="lineno"> 353</span> <span class="keyword">public</span>:</div>
|
|
<div class="line"><a id="l00354" name="l00354"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#ab93548508ad14a5cecdaafa67db47cd9"> 354</a></span> <span class="keyword">explicit</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#ab93548508ad14a5cecdaafa67db47cd9">SharedTimeLimit</a>(<a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* time_limit)</div>
|
|
<div class="line"><a id="l00355" name="l00355"></a><span class="lineno"> 355</span> : time_limit_(time_limit), stopped_boolean_(false) {</div>
|
|
<div class="line"><a id="l00356" name="l00356"></a><span class="lineno"> 356</span> <span class="comment">// We use the one already registered if present or ours otherwise.</span></div>
|
|
<div class="line"><a id="l00357" name="l00357"></a><span class="lineno"> 357</span> stopped_ = time_limit-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4747b1676f59ae0ccca60bb4c414de08">ExternalBooleanAsLimit</a>();</div>
|
|
<div class="line"><a id="l00358" name="l00358"></a><span class="lineno"> 358</span> <span class="keywordflow">if</span> (stopped_ == <span class="keyword">nullptr</span>) {</div>
|
|
<div class="line"><a id="l00359" name="l00359"></a><span class="lineno"> 359</span> stopped_ = &stopped_boolean_;</div>
|
|
<div class="line"><a id="l00360" name="l00360"></a><span class="lineno"> 360</span> time_limit-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a5b6cf15a55615535aa54e71103de8d9f">RegisterExternalBooleanAsLimit</a>(stopped_);</div>
|
|
<div class="line"><a id="l00361" name="l00361"></a><span class="lineno"> 361</span> }</div>
|
|
<div class="line"><a id="l00362" name="l00362"></a><span class="lineno"> 362</span> }</div>
|
|
<div class="line"><a id="l00363" name="l00363"></a><span class="lineno"> 363</span> </div>
|
|
<div class="line"><a id="l00364" name="l00364"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#ac814f11492bfc0b561c58bf951e1b031"> 364</a></span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#ac814f11492bfc0b561c58bf951e1b031">~SharedTimeLimit</a>() {</div>
|
|
<div class="line"><a id="l00365" name="l00365"></a><span class="lineno"> 365</span> <span class="keywordflow">if</span> (stopped_ == &stopped_boolean_) {</div>
|
|
<div class="line"><a id="l00366" name="l00366"></a><span class="lineno"> 366</span> time_limit_->RegisterExternalBooleanAsLimit(<span class="keyword">nullptr</span>);</div>
|
|
<div class="line"><a id="l00367" name="l00367"></a><span class="lineno"> 367</span> }</div>
|
|
<div class="line"><a id="l00368" name="l00368"></a><span class="lineno"> 368</span> }</div>
|
|
<div class="line"><a id="l00369" name="l00369"></a><span class="lineno"> 369</span> </div>
|
|
<div class="line"><a id="l00370" name="l00370"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#ad837e6231722ead53bbaf1c6e8f66032"> 370</a></span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#ad837e6231722ead53bbaf1c6e8f66032">LimitReached</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00371" name="l00371"></a><span class="lineno"> 371</span> <span class="comment">// Note, time_limit_->LimitReached() is not const, and changes internal</span></div>
|
|
<div class="line"><a id="l00372" name="l00372"></a><span class="lineno"> 372</span> <span class="comment">// state of time_limit_, hence we need a writer's lock.</span></div>
|
|
<div class="line"><a id="l00373" name="l00373"></a><span class="lineno"> 373</span> absl::MutexLock lock(&mutex_);</div>
|
|
<div class="line"><a id="l00374" name="l00374"></a><span class="lineno"> 374</span> <span class="keywordflow">return</span> time_limit_->LimitReached();</div>
|
|
<div class="line"><a id="l00375" name="l00375"></a><span class="lineno"> 375</span> }</div>
|
|
<div class="line"><a id="l00376" name="l00376"></a><span class="lineno"> 376</span> </div>
|
|
<div class="line"><a id="l00377" name="l00377"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#a17a237457e57625296e6b24feb19c60a"> 377</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#a17a237457e57625296e6b24feb19c60a">Stop</a>() {</div>
|
|
<div class="line"><a id="l00378" name="l00378"></a><span class="lineno"> 378</span> absl::MutexLock lock(&mutex_);</div>
|
|
<div class="line"><a id="l00379" name="l00379"></a><span class="lineno"> 379</span> *stopped_ = <span class="keyword">true</span>;</div>
|
|
<div class="line"><a id="l00380" name="l00380"></a><span class="lineno"> 380</span> }</div>
|
|
<div class="line"><a id="l00381" name="l00381"></a><span class="lineno"> 381</span> </div>
|
|
<div class="line"><a id="l00382" name="l00382"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#a3d37e6e18c64cbaef0e3a118aeb351da"> 382</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#a3d37e6e18c64cbaef0e3a118aeb351da">UpdateLocalLimit</a>(<a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* local_limit) {</div>
|
|
<div class="line"><a id="l00383" name="l00383"></a><span class="lineno"> 383</span> absl::MutexLock lock(&mutex_);</div>
|
|
<div class="line"><a id="l00384" name="l00384"></a><span class="lineno"> 384</span> local_limit-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ad0cdf04d71ac4f14262eb4871041ddbd">MergeWithGlobalTimeLimit</a>(time_limit_);</div>
|
|
<div class="line"><a id="l00385" name="l00385"></a><span class="lineno"> 385</span> }</div>
|
|
<div class="line"><a id="l00386" name="l00386"></a><span class="lineno"> 386</span> </div>
|
|
<div class="line"><a id="l00387" name="l00387"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9"> 387</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9">AdvanceDeterministicTime</a>(<span class="keywordtype">double</span> deterministic_duration) {</div>
|
|
<div class="line"><a id="l00388" name="l00388"></a><span class="lineno"> 388</span> absl::MutexLock lock(&mutex_);</div>
|
|
<div class="line"><a id="l00389" name="l00389"></a><span class="lineno"> 389</span> time_limit_->AdvanceDeterministicTime(deterministic_duration);</div>
|
|
<div class="line"><a id="l00390" name="l00390"></a><span class="lineno"> 390</span> }</div>
|
|
<div class="line"><a id="l00391" name="l00391"></a><span class="lineno"> 391</span> </div>
|
|
<div class="line"><a id="l00392" name="l00392"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715"> 392</a></span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">GetTimeLeft</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00393" name="l00393"></a><span class="lineno"> 393</span> absl::ReaderMutexLock lock(&mutex_);</div>
|
|
<div class="line"><a id="l00394" name="l00394"></a><span class="lineno"> 394</span> <span class="keywordflow">return</span> time_limit_->GetTimeLeft();</div>
|
|
<div class="line"><a id="l00395" name="l00395"></a><span class="lineno"> 395</span> }</div>
|
|
<div class="line"><a id="l00396" name="l00396"></a><span class="lineno"> 396</span> </div>
|
|
<div class="line"><a id="l00397" name="l00397"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_shared_time_limit.html#ac7e861414a70fc937d18bc7ca743fc98"> 397</a></span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_shared_time_limit.html#ac7e861414a70fc937d18bc7ca743fc98">GetElapsedDeterministicTime</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00398" name="l00398"></a><span class="lineno"> 398</span> absl::ReaderMutexLock lock(&mutex_);</div>
|
|
<div class="line"><a id="l00399" name="l00399"></a><span class="lineno"> 399</span> <span class="keywordflow">return</span> time_limit_->GetElapsedDeterministicTime();</div>
|
|
<div class="line"><a id="l00400" name="l00400"></a><span class="lineno"> 400</span> }</div>
|
|
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno"> 401</span> </div>
|
|
<div class="line"><a id="l00402" name="l00402"></a><span class="lineno"> 402</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a id="l00403" name="l00403"></a><span class="lineno"> 403</span> <span class="keyword">mutable</span> absl::Mutex mutex_;</div>
|
|
<div class="line"><a id="l00404" name="l00404"></a><span class="lineno"> 404</span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* time_limit_ ABSL_GUARDED_BY(mutex_);</div>
|
|
<div class="line"><a id="l00405" name="l00405"></a><span class="lineno"> 405</span> std::atomic<bool> stopped_boolean_ ABSL_GUARDED_BY(mutex_);</div>
|
|
<div class="line"><a id="l00406" name="l00406"></a><span class="lineno"> 406</span> std::atomic<bool>* stopped_ ABSL_GUARDED_BY(mutex_);</div>
|
|
<div class="line"><a id="l00407" name="l00407"></a><span class="lineno"> 407</span>};</div>
|
|
<div class="line"><a id="l00408" name="l00408"></a><span class="lineno"> 408</span> </div>
|
|
<div class="line"><a id="l00439" name="l00439"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_nested_time_limit.html"> 439</a></span><span class="keyword">class </span><a class="code hl_class" href="classoperations__research_1_1_nested_time_limit.html">NestedTimeLimit</a> {</div>
|
|
<div class="line"><a id="l00440" name="l00440"></a><span class="lineno"> 440</span> <span class="keyword">public</span>:</div>
|
|
<div class="line"><a id="l00445" name="l00445"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_nested_time_limit.html#af23d2dc1b291081b642a728cf0033987"> 445</a></span> <a class="code hl_function" href="classoperations__research_1_1_nested_time_limit.html#af23d2dc1b291081b642a728cf0033987">NestedTimeLimit</a>(<a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* base_time_limit, <span class="keywordtype">double</span> limit_in_seconds,</div>
|
|
<div class="line"><a id="l00446" name="l00446"></a><span class="lineno"> 446</span> <span class="keywordtype">double</span> deterministic_limit);</div>
|
|
<div class="line"><a id="l00447" name="l00447"></a><span class="lineno"> 447</span> </div>
|
|
<div class="line"><a id="l00451" name="l00451"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_nested_time_limit.html#acc74615391497a1874ffb69d751f80af"> 451</a></span> <a class="code hl_function" href="classoperations__research_1_1_nested_time_limit.html#acc74615391497a1874ffb69d751f80af">~NestedTimeLimit</a>();</div>
|
|
<div class="line"><a id="l00452" name="l00452"></a><span class="lineno"> 452</span> </div>
|
|
<div class="line"><a id="l00460" name="l00460"></a><span class="lineno"> 460</span> <span class="keyword">template</span> <<span class="keyword">typename</span> Parameters></div>
|
|
<div class="line"><a id="l00461" name="l00461"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_nested_time_limit.html#ac0a06147cfecf60718b19a570bf64633"> 461</a></span> <span class="keyword">static</span> std::unique_ptr<NestedTimeLimit> <a class="code hl_function" href="classoperations__research_1_1_nested_time_limit.html#ac0a06147cfecf60718b19a570bf64633">FromBaseTimeLimitAndParameters</a>(</div>
|
|
<div class="line"><a id="l00462" name="l00462"></a><span class="lineno"> 462</span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* time_limit, <span class="keyword">const</span> Parameters& parameters) {</div>
|
|
<div class="line"><a id="l00463" name="l00463"></a><span class="lineno"> 463</span> <span class="keywordflow">return</span> absl::make_unique<NestedTimeLimit>(</div>
|
|
<div class="line"><a id="l00464" name="l00464"></a><span class="lineno"> 464</span> time_limit, parameters.max_time_in_seconds(),</div>
|
|
<div class="line"><a id="l00465" name="l00465"></a><span class="lineno"> 465</span> parameters.max_deterministic_time());</div>
|
|
<div class="line"><a id="l00466" name="l00466"></a><span class="lineno"> 466</span> }</div>
|
|
<div class="line"><a id="l00467" name="l00467"></a><span class="lineno"> 467</span> </div>
|
|
<div class="line"><a id="l00474" name="l00474"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_nested_time_limit.html#ac4d1c84d36c63793f769538c463401ca"> 474</a></span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* <a class="code hl_function" href="classoperations__research_1_1_nested_time_limit.html#ac4d1c84d36c63793f769538c463401ca">GetTimeLimit</a>() { <span class="keywordflow">return</span> &time_limit_; }</div>
|
|
<div class="line"><a id="l00475" name="l00475"></a><span class="lineno"> 475</span> </div>
|
|
<div class="line"><a id="l00476" name="l00476"></a><span class="lineno"> 476</span> <span class="keyword">private</span>:</div>
|
|
<div class="line"><a id="l00477" name="l00477"></a><span class="lineno"> 477</span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* <span class="keyword">const</span> base_time_limit_;</div>
|
|
<div class="line"><a id="l00478" name="l00478"></a><span class="lineno"> 478</span> <a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a> time_limit_;</div>
|
|
<div class="line"><a id="l00479" name="l00479"></a><span class="lineno"> 479</span> </div>
|
|
<div class="line"><a id="l00480" name="l00480"></a><span class="lineno"> 480</span> DISALLOW_COPY_AND_ASSIGN(<a class="code hl_class" href="classoperations__research_1_1_nested_time_limit.html">NestedTimeLimit</a>);</div>
|
|
<div class="line"><a id="l00481" name="l00481"></a><span class="lineno"> 481</span>};</div>
|
|
<div class="line"><a id="l00482" name="l00482"></a><span class="lineno"> 482</span> </div>
|
|
<div class="line"><a id="l00483" name="l00483"></a><span class="lineno"> 483</span><span class="comment">// ################## Implementations below #####################</span></div>
|
|
<div class="line"><a id="l00484" name="l00484"></a><span class="lineno"> 484</span> </div>
|
|
<div class="line"><a id="l00485" name="l00485"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#aa0975c0aa18ee607a54e7c4c8986ff0f"> 485</a></span><span class="keyword">inline</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a0598aaf87dab140f870c8ada2a1f3a39">TimeLimit::TimeLimit</a>(<span class="keywordtype">double</span> limit_in_seconds, <span class="keywordtype">double</span> deterministic_limit,</div>
|
|
<div class="line"><a id="l00486" name="l00486"></a><span class="lineno"> 486</span> <span class="keywordtype">double</span> instruction_limit)</div>
|
|
<div class="line"><a id="l00487" name="l00487"></a><span class="lineno"> 487</span> : safety_buffer_ns_(static_cast<int64_t>(kSafetyBufferSeconds * 1e9)),</div>
|
|
<div class="line"><a id="l00488" name="l00488"></a><span class="lineno"> 488</span> running_max_(kHistorySize),</div>
|
|
<div class="line"><a id="l00489" name="l00489"></a><span class="lineno"> 489</span> external_boolean_as_limit_(nullptr) {</div>
|
|
<div class="line"><a id="l00490" name="l00490"></a><span class="lineno"> 490</span> ResetTimers(limit_in_seconds, deterministic_limit, instruction_limit);</div>
|
|
<div class="line"><a id="l00491" name="l00491"></a><span class="lineno"> 491</span>}</div>
|
|
<div class="line"><a id="l00492" name="l00492"></a><span class="lineno"> 492</span> </div>
|
|
<div class="line"><a id="l00493" name="l00493"></a><span class="lineno"> 493</span><span class="keyword">inline</span> <span class="keywordtype">void</span> TimeLimit::ResetTimers(<span class="keywordtype">double</span> limit_in_seconds,</div>
|
|
<div class="line"><a id="l00494" name="l00494"></a><span class="lineno"> 494</span> <span class="keywordtype">double</span> deterministic_limit,</div>
|
|
<div class="line"><a id="l00495" name="l00495"></a><span class="lineno"> 495</span> <span class="keywordtype">double</span> instruction_limit) {</div>
|
|
<div class="line"><a id="l00496" name="l00496"></a><span class="lineno"> 496</span> elapsed_deterministic_time_ = 0.0;</div>
|
|
<div class="line"><a id="l00497" name="l00497"></a><span class="lineno"> 497</span> deterministic_limit_ = deterministic_limit;</div>
|
|
<div class="line"><a id="l00498" name="l00498"></a><span class="lineno"> 498</span> instruction_limit_ = instruction_limit;</div>
|
|
<div class="line"><a id="l00499" name="l00499"></a><span class="lineno"> 499</span> </div>
|
|
<div class="line"><a id="l00500" name="l00500"></a><span class="lineno"> 500</span> <span class="keywordflow">if</span> (absl::GetFlag(FLAGS_time_limit_use_usertime)) {</div>
|
|
<div class="line"><a id="l00501" name="l00501"></a><span class="lineno"> 501</span> user_timer_.Start();</div>
|
|
<div class="line"><a id="l00502" name="l00502"></a><span class="lineno"> 502</span> limit_in_seconds_ = limit_in_seconds;</div>
|
|
<div class="line"><a id="l00503" name="l00503"></a><span class="lineno"> 503</span> }</div>
|
|
<div class="line"><a id="l00504" name="l00504"></a><span class="lineno"> 504</span><span class="preprocessor">#ifdef HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00505" name="l00505"></a><span class="lineno"> 505</span> <span class="keywordflow">if</span> (absl::GetFlag(FLAGS_time_limit_use_instruction_count)) {</div>
|
|
<div class="line"><a id="l00506" name="l00506"></a><span class="lineno"> 506</span> perf_subsystem_.CleanUp();</div>
|
|
<div class="line"><a id="l00507" name="l00507"></a><span class="lineno"> 507</span> perf_subsystem_.AddEvent(GetInstructionRetiredEventName());</div>
|
|
<div class="line"><a id="l00508" name="l00508"></a><span class="lineno"> 508</span> perf_subsystem_.StartCollecting();</div>
|
|
<div class="line"><a id="l00509" name="l00509"></a><span class="lineno"> 509</span> }</div>
|
|
<div class="line"><a id="l00510" name="l00510"></a><span class="lineno"> 510</span><span class="preprocessor">#endif </span><span class="comment">// HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00511" name="l00511"></a><span class="lineno"> 511</span> start_ns_ = absl::GetCurrentTimeNanos();</div>
|
|
<div class="line"><a id="l00512" name="l00512"></a><span class="lineno"> 512</span> last_ns_ = start_ns_;</div>
|
|
<div class="line"><a id="l00513" name="l00513"></a><span class="lineno"> 513</span> limit_ns_ = limit_in_seconds >= 1e-9 * (kint64max - start_ns_)</div>
|
|
<div class="line"><a id="l00514" name="l00514"></a><span class="lineno"> 514</span> ? kint64max</div>
|
|
<div class="line"><a id="l00515" name="l00515"></a><span class="lineno"> 515</span> : <span class="keyword">static_cast<</span>int64_t<span class="keyword">></span>(limit_in_seconds * 1e9) + start_ns_;</div>
|
|
<div class="line"><a id="l00516" name="l00516"></a><span class="lineno"> 516</span>}</div>
|
|
<div class="line"><a id="l00517" name="l00517"></a><span class="lineno"> 517</span> </div>
|
|
<div class="line"><a id="l00518" name="l00518"></a><span class="lineno"> 518</span><span class="keyword">template</span> <<span class="keyword">typename</span> Parameters></div>
|
|
<div class="line"><a id="l00519" name="l00519"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a312550ebabce586fb77c49e813c610f8"> 519</a></span><span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a312550ebabce586fb77c49e813c610f8">TimeLimit::ResetLimitFromParameters</a>(<span class="keyword">const</span> Parameters& parameters) {</div>
|
|
<div class="line"><a id="l00520" name="l00520"></a><span class="lineno"> 520</span> ResetTimers(parameters.max_time_in_seconds(),</div>
|
|
<div class="line"><a id="l00521" name="l00521"></a><span class="lineno"> 521</span> parameters.max_deterministic_time(),</div>
|
|
<div class="line"><a id="l00522" name="l00522"></a><span class="lineno"> 522</span> std::numeric_limits<double>::infinity());</div>
|
|
<div class="line"><a id="l00523" name="l00523"></a><span class="lineno"> 523</span>}</div>
|
|
<div class="line"><a id="l00524" name="l00524"></a><span class="lineno"> 524</span> </div>
|
|
<div class="line"><a id="l00525" name="l00525"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#ad0cdf04d71ac4f14262eb4871041ddbd"> 525</a></span><span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#ad0cdf04d71ac4f14262eb4871041ddbd">TimeLimit::MergeWithGlobalTimeLimit</a>(<a class="code hl_class" href="classoperations__research_1_1_time_limit.html">TimeLimit</a>* other) {</div>
|
|
<div class="line"><a id="l00526" name="l00526"></a><span class="lineno"> 526</span> <span class="keywordflow">if</span> (other == <span class="keyword">nullptr</span>) <span class="keywordflow">return</span>;</div>
|
|
<div class="line"><a id="l00527" name="l00527"></a><span class="lineno"> 527</span> ResetTimers(</div>
|
|
<div class="line"><a id="l00528" name="l00528"></a><span class="lineno"> 528</span> std::min(<a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">GetTimeLeft</a>(), other-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">GetTimeLeft</a>()),</div>
|
|
<div class="line"><a id="l00529" name="l00529"></a><span class="lineno"> 529</span> std::min(<a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a362a88bfe50d83c028154a62ef53e780">GetDeterministicTimeLeft</a>(), other-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a362a88bfe50d83c028154a62ef53e780">GetDeterministicTimeLeft</a>()),</div>
|
|
<div class="line"><a id="l00530" name="l00530"></a><span class="lineno"> 530</span> std::numeric_limits<double>::infinity());</div>
|
|
<div class="line"><a id="l00531" name="l00531"></a><span class="lineno"> 531</span> <span class="keywordflow">if</span> (other-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4747b1676f59ae0ccca60bb4c414de08">ExternalBooleanAsLimit</a>() != <span class="keyword">nullptr</span>) {</div>
|
|
<div class="line"><a id="l00532" name="l00532"></a><span class="lineno"> 532</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a5b6cf15a55615535aa54e71103de8d9f">RegisterExternalBooleanAsLimit</a>(other-><a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4747b1676f59ae0ccca60bb4c414de08">ExternalBooleanAsLimit</a>());</div>
|
|
<div class="line"><a id="l00533" name="l00533"></a><span class="lineno"> 533</span> }</div>
|
|
<div class="line"><a id="l00534" name="l00534"></a><span class="lineno"> 534</span>}</div>
|
|
<div class="line"><a id="l00535" name="l00535"></a><span class="lineno"> 535</span> </div>
|
|
<div class="line"><a id="l00536" name="l00536"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a4cb3517d59bf4642a85294267736af20"> 536</a></span><span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4cb3517d59bf4642a85294267736af20">TimeLimit::ReadInstructionCounter</a>() {</div>
|
|
<div class="line"><a id="l00537" name="l00537"></a><span class="lineno"> 537</span><span class="preprocessor">#ifdef HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00538" name="l00538"></a><span class="lineno"> 538</span> <span class="keywordflow">if</span> (absl::GetFlag(FLAGS_time_limit_use_instruction_count)) {</div>
|
|
<div class="line"><a id="l00539" name="l00539"></a><span class="lineno"> 539</span> <span class="keywordflow">return</span> perf_subsystem_.ReadCounters().GetScaledOrDie(</div>
|
|
<div class="line"><a id="l00540" name="l00540"></a><span class="lineno"> 540</span> GetInstructionRetiredEventName());</div>
|
|
<div class="line"><a id="l00541" name="l00541"></a><span class="lineno"> 541</span> }</div>
|
|
<div class="line"><a id="l00542" name="l00542"></a><span class="lineno"> 542</span><span class="preprocessor">#endif </span><span class="comment">// HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00543" name="l00543"></a><span class="lineno"> 543</span> <span class="keywordflow">return</span> 0;</div>
|
|
<div class="line"><a id="l00544" name="l00544"></a><span class="lineno"> 544</span>}</div>
|
|
<div class="line"><a id="l00545" name="l00545"></a><span class="lineno"> 545</span> </div>
|
|
<div class="line"><a id="l00546" name="l00546"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a810d5f7aaf80cc09cf5a094e20c1aaca"> 546</a></span><span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a810d5f7aaf80cc09cf5a094e20c1aaca">TimeLimit::LimitReached</a>() {</div>
|
|
<div class="line"><a id="l00547" name="l00547"></a><span class="lineno"> 547</span> <span class="keywordflow">if</span> (external_boolean_as_limit_ != <span class="keyword">nullptr</span> &&</div>
|
|
<div class="line"><a id="l00548" name="l00548"></a><span class="lineno"> 548</span> external_boolean_as_limit_->load()) {</div>
|
|
<div class="line"><a id="l00549" name="l00549"></a><span class="lineno"> 549</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
|
<div class="line"><a id="l00550" name="l00550"></a><span class="lineno"> 550</span> }</div>
|
|
<div class="line"><a id="l00551" name="l00551"></a><span class="lineno"> 551</span> </div>
|
|
<div class="line"><a id="l00552" name="l00552"></a><span class="lineno"> 552</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a362a88bfe50d83c028154a62ef53e780">GetDeterministicTimeLeft</a>() <= 0.0) {</div>
|
|
<div class="line"><a id="l00553" name="l00553"></a><span class="lineno"> 553</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
|
<div class="line"><a id="l00554" name="l00554"></a><span class="lineno"> 554</span> }</div>
|
|
<div class="line"><a id="l00555" name="l00555"></a><span class="lineno"> 555</span> </div>
|
|
<div class="line"><a id="l00556" name="l00556"></a><span class="lineno"> 556</span><span class="preprocessor">#ifdef HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00557" name="l00557"></a><span class="lineno"> 557</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4cb3517d59bf4642a85294267736af20">ReadInstructionCounter</a>() >= instruction_limit_) {</div>
|
|
<div class="line"><a id="l00558" name="l00558"></a><span class="lineno"> 558</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
|
<div class="line"><a id="l00559" name="l00559"></a><span class="lineno"> 559</span> }</div>
|
|
<div class="line"><a id="l00560" name="l00560"></a><span class="lineno"> 560</span><span class="preprocessor">#endif </span><span class="comment">// HAS_PERF_SUBSYSTEM</span></div>
|
|
<div class="line"><a id="l00561" name="l00561"></a><span class="lineno"> 561</span> </div>
|
|
<div class="line"><a id="l00562" name="l00562"></a><span class="lineno"> 562</span> <span class="keyword">const</span> int64_t current_ns = absl::GetCurrentTimeNanos();</div>
|
|
<div class="line"><a id="l00563" name="l00563"></a><span class="lineno"> 563</span> running_max_.Add(std::max(safety_buffer_ns_, current_ns - last_ns_));</div>
|
|
<div class="line"><a id="l00564" name="l00564"></a><span class="lineno"> 564</span> last_ns_ = current_ns;</div>
|
|
<div class="line"><a id="l00565" name="l00565"></a><span class="lineno"> 565</span> <span class="keywordflow">if</span> (current_ns + running_max_.GetCurrentMax() >= limit_ns_) {</div>
|
|
<div class="line"><a id="l00566" name="l00566"></a><span class="lineno"> 566</span> <span class="keywordflow">if</span> (absl::GetFlag(FLAGS_time_limit_use_usertime)) {</div>
|
|
<div class="line"><a id="l00567" name="l00567"></a><span class="lineno"> 567</span> <span class="comment">// To avoid making many system calls, we only check the user time when</span></div>
|
|
<div class="line"><a id="l00568" name="l00568"></a><span class="lineno"> 568</span> <span class="comment">// the "absolute" time limit has been reached. Note that the user time</span></div>
|
|
<div class="line"><a id="l00569" name="l00569"></a><span class="lineno"> 569</span> <span class="comment">// should advance more slowly, so this is correct.</span></div>
|
|
<div class="line"><a id="l00570" name="l00570"></a><span class="lineno"> 570</span> <span class="keyword">const</span> <span class="keywordtype">double</span> time_left_s = limit_in_seconds_ - user_timer_.Get();</div>
|
|
<div class="line"><a id="l00571" name="l00571"></a><span class="lineno"> 571</span> <span class="keywordflow">if</span> (time_left_s > <a class="code hl_variable" href="classoperations__research_1_1_time_limit.html#a1837453fa693143e6ec334701557a448">kSafetyBufferSeconds</a>) {</div>
|
|
<div class="line"><a id="l00572" name="l00572"></a><span class="lineno"> 572</span> limit_ns_ = <span class="keyword">static_cast<</span>int64_t<span class="keyword">></span>(time_left_s * 1e9) + last_ns_;</div>
|
|
<div class="line"><a id="l00573" name="l00573"></a><span class="lineno"> 573</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
|
<div class="line"><a id="l00574" name="l00574"></a><span class="lineno"> 574</span> }</div>
|
|
<div class="line"><a id="l00575" name="l00575"></a><span class="lineno"> 575</span> }</div>
|
|
<div class="line"><a id="l00576" name="l00576"></a><span class="lineno"> 576</span> </div>
|
|
<div class="line"><a id="l00577" name="l00577"></a><span class="lineno"> 577</span> <span class="comment">// To ensure that future calls to LimitReached() will return true.</span></div>
|
|
<div class="line"><a id="l00578" name="l00578"></a><span class="lineno"> 578</span> limit_ns_ = 0;</div>
|
|
<div class="line"><a id="l00579" name="l00579"></a><span class="lineno"> 579</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
|
<div class="line"><a id="l00580" name="l00580"></a><span class="lineno"> 580</span> }</div>
|
|
<div class="line"><a id="l00581" name="l00581"></a><span class="lineno"> 581</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
|
<div class="line"><a id="l00582" name="l00582"></a><span class="lineno"> 582</span>}</div>
|
|
<div class="line"><a id="l00583" name="l00583"></a><span class="lineno"> 583</span> </div>
|
|
<div class="line"><a id="l00584" name="l00584"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715"> 584</a></span><span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">TimeLimit::GetTimeLeft</a>()<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00585" name="l00585"></a><span class="lineno"> 585</span> <span class="keywordflow">if</span> (limit_ns_ == kint64max) <span class="keywordflow">return</span> std::numeric_limits<double>::infinity();</div>
|
|
<div class="line"><a id="l00586" name="l00586"></a><span class="lineno"> 586</span> <span class="keyword">const</span> int64_t delta_ns = limit_ns_ - absl::GetCurrentTimeNanos();</div>
|
|
<div class="line"><a id="l00587" name="l00587"></a><span class="lineno"> 587</span> <span class="keywordflow">if</span> (delta_ns < 0) <span class="keywordflow">return</span> 0.0;</div>
|
|
<div class="line"><a id="l00588" name="l00588"></a><span class="lineno"> 588</span> <span class="keywordflow">if</span> (absl::GetFlag(FLAGS_time_limit_use_usertime)) {</div>
|
|
<div class="line"><a id="l00589" name="l00589"></a><span class="lineno"> 589</span> <span class="keywordflow">return</span> std::max(limit_in_seconds_ - user_timer_.Get(), 0.0);</div>
|
|
<div class="line"><a id="l00590" name="l00590"></a><span class="lineno"> 590</span> } <span class="keywordflow">else</span> {</div>
|
|
<div class="line"><a id="l00591" name="l00591"></a><span class="lineno"> 591</span> <span class="keywordflow">return</span> delta_ns * 1e-9;</div>
|
|
<div class="line"><a id="l00592" name="l00592"></a><span class="lineno"> 592</span> }</div>
|
|
<div class="line"><a id="l00593" name="l00593"></a><span class="lineno"> 593</span>}</div>
|
|
<div class="line"><a id="l00594" name="l00594"></a><span class="lineno"> 594</span> </div>
|
|
<div class="line"><a id="l00595" name="l00595"></a><span class="lineno"><a class="line" href="classoperations__research_1_1_time_limit.html#a0be73bea3d751ca2926c1cd616abb31e"> 595</a></span><span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a0be73bea3d751ca2926c1cd616abb31e">TimeLimit::GetInstructionsLeft</a>() {</div>
|
|
<div class="line"><a id="l00596" name="l00596"></a><span class="lineno"> 596</span> <span class="keywordflow">return</span> std::max(instruction_limit_ - <a class="code hl_function" href="classoperations__research_1_1_time_limit.html#a4cb3517d59bf4642a85294267736af20">ReadInstructionCounter</a>(), 0.0);</div>
|
|
<div class="line"><a id="l00597" name="l00597"></a><span class="lineno"> 597</span>}</div>
|
|
<div class="line"><a id="l00598" name="l00598"></a><span class="lineno"> 598</span> </div>
|
|
<div class="line"><a id="l00599" name="l00599"></a><span class="lineno"> 599</span>} <span class="comment">// namespace operations_research</span></div>
|
|
<div class="line"><a id="l00600" name="l00600"></a><span class="lineno"> 600</span> </div>
|
|
<div class="line"><a id="l00601" name="l00601"></a><span class="lineno"> 601</span><span class="preprocessor">#endif </span><span class="comment">// OR_TOOLS_UTIL_TIME_LIMIT_H_</span></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_nested_time_limit_html"><div class="ttname"><a href="classoperations__research_1_1_nested_time_limit.html">operations_research::NestedTimeLimit</a></div><div class="ttdoc">Provides a way to nest time limits for algorithms where a certain part of the computation is bounded ...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00439">time_limit.h:439</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_nested_time_limit_html_ac0a06147cfecf60718b19a570bf64633"><div class="ttname"><a href="classoperations__research_1_1_nested_time_limit.html#ac0a06147cfecf60718b19a570bf64633">operations_research::NestedTimeLimit::FromBaseTimeLimitAndParameters</a></div><div class="ttdeci">static std::unique_ptr< NestedTimeLimit > FromBaseTimeLimitAndParameters(TimeLimit *time_limit, const Parameters &parameters)</div><div class="ttdoc">Creates a time limit object initialized from a base time limit and an object that provides methods ma...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00461">time_limit.h:461</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_nested_time_limit_html_ac4d1c84d36c63793f769538c463401ca"><div class="ttname"><a href="classoperations__research_1_1_nested_time_limit.html#ac4d1c84d36c63793f769538c463401ca">operations_research::NestedTimeLimit::GetTimeLimit</a></div><div class="ttdeci">TimeLimit * GetTimeLimit()</div><div class="ttdoc">Returns a time limit object that represents the combination of the overall time limit and the part-sp...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00474">time_limit.h:474</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_nested_time_limit_html_acc74615391497a1874ffb69d751f80af"><div class="ttname"><a href="classoperations__research_1_1_nested_time_limit.html#acc74615391497a1874ffb69d751f80af">operations_research::NestedTimeLimit::~NestedTimeLimit</a></div><div class="ttdeci">~NestedTimeLimit()</div><div class="ttdoc">Updates elapsed deterministic time in the base time limit object.</div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_nested_time_limit_html_af23d2dc1b291081b642a728cf0033987"><div class="ttname"><a href="classoperations__research_1_1_nested_time_limit.html#af23d2dc1b291081b642a728cf0033987">operations_research::NestedTimeLimit::NestedTimeLimit</a></div><div class="ttdeci">NestedTimeLimit(TimeLimit *base_time_limit, double limit_in_seconds, double deterministic_limit)</div><div class="ttdoc">Creates the nested time limit.</div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html">operations_research::SharedTimeLimit</a></div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00352">time_limit.h:352</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_a17a237457e57625296e6b24feb19c60a"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#a17a237457e57625296e6b24feb19c60a">operations_research::SharedTimeLimit::Stop</a></div><div class="ttdeci">void Stop()</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00377">time_limit.h:377</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_a3d37e6e18c64cbaef0e3a118aeb351da"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#a3d37e6e18c64cbaef0e3a118aeb351da">operations_research::SharedTimeLimit::UpdateLocalLimit</a></div><div class="ttdeci">void UpdateLocalLimit(TimeLimit *local_limit)</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00382">time_limit.h:382</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_a4273b83b06bfbf856393db6d0a9b8715"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">operations_research::SharedTimeLimit::GetTimeLeft</a></div><div class="ttdeci">double GetTimeLeft() const</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00392">time_limit.h:392</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_ab93548508ad14a5cecdaafa67db47cd9"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#ab93548508ad14a5cecdaafa67db47cd9">operations_research::SharedTimeLimit::SharedTimeLimit</a></div><div class="ttdeci">SharedTimeLimit(TimeLimit *time_limit)</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00354">time_limit.h:354</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_ac7e861414a70fc937d18bc7ca743fc98"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#ac7e861414a70fc937d18bc7ca743fc98">operations_research::SharedTimeLimit::GetElapsedDeterministicTime</a></div><div class="ttdeci">double GetElapsedDeterministicTime() const</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00397">time_limit.h:397</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_ac814f11492bfc0b561c58bf951e1b031"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#ac814f11492bfc0b561c58bf951e1b031">operations_research::SharedTimeLimit::~SharedTimeLimit</a></div><div class="ttdeci">~SharedTimeLimit()</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00364">time_limit.h:364</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_ad837e6231722ead53bbaf1c6e8f66032"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#ad837e6231722ead53bbaf1c6e8f66032">operations_research::SharedTimeLimit::LimitReached</a></div><div class="ttdeci">bool LimitReached() const</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00370">time_limit.h:370</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_shared_time_limit_html_af90cfd1fc238433fc303ee28c5914eb9"><div class="ttname"><a href="classoperations__research_1_1_shared_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9">operations_research::SharedTimeLimit::AdvanceDeterministicTime</a></div><div class="ttdeci">void AdvanceDeterministicTime(double deterministic_duration)</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00387">time_limit.h:387</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html">operations_research::TimeLimit</a></div><div class="ttdoc">A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00106">time_limit.h:106</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a0598aaf87dab140f870c8ada2a1f3a39"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a0598aaf87dab140f870c8ada2a1f3a39">operations_research::TimeLimit::TimeLimit</a></div><div class="ttdeci">TimeLimit()</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00127">time_limit.h:127</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a0be73bea3d751ca2926c1cd616abb31e"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a0be73bea3d751ca2926c1cd616abb31e">operations_research::TimeLimit::GetInstructionsLeft</a></div><div class="ttdeci">double GetInstructionsLeft()</div><div class="ttdoc">Returns the number of instructions left to reach the limit.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00595">time_limit.h:595</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a0ea9620e492bd75ea7e2fcded8f1de8b"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a0ea9620e492bd75ea7e2fcded8f1de8b">operations_research::TimeLimit::FromParameters</a></div><div class="ttdeci">static std::unique_ptr< TimeLimit > FromParameters(const Parameters &parameters)</div><div class="ttdoc">Creates a time limit object initialized from an object that provides methods max_time_in_seconds() an...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00160">time_limit.h:160</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a1837453fa693143e6ec334701557a448"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a1837453fa693143e6ec334701557a448">operations_research::TimeLimit::kSafetyBufferSeconds</a></div><div class="ttdeci">static const double kSafetyBufferSeconds</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00108">time_limit.h:108</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a312550ebabce586fb77c49e813c610f8"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a312550ebabce586fb77c49e813c610f8">operations_research::TimeLimit::ResetLimitFromParameters</a></div><div class="ttdeci">void ResetLimitFromParameters(const Parameters &parameters)</div><div class="ttdoc">Sets new time limits.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00519">time_limit.h:519</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a362a88bfe50d83c028154a62ef53e780"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a362a88bfe50d83c028154a62ef53e780">operations_research::TimeLimit::GetDeterministicTimeLeft</a></div><div class="ttdeci">double GetDeterministicTimeLeft() const</div><div class="ttdoc">Returns the remaining deterministic time before LimitReached() returns true due to the deterministic ...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00213">time_limit.h:213</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a4273b83b06bfbf856393db6d0a9b8715"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a4273b83b06bfbf856393db6d0a9b8715">operations_research::TimeLimit::GetTimeLeft</a></div><div class="ttdeci">double GetTimeLeft() const</div><div class="ttdoc">Returns the time left on this limit, or 0 if the limit was reached (it never returns a negative value...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00584">time_limit.h:584</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a43229b9a540c5b4c3751ebb13e73ace8"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a43229b9a540c5b4c3751ebb13e73ace8">operations_research::TimeLimit::SetInstructionLimit</a></div><div class="ttdeci">void SetInstructionLimit(double instruction_limit)</div><div class="ttdoc">Sets the instruction limit.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00172">time_limit.h:172</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a4747b1676f59ae0ccca60bb4c414de08"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a4747b1676f59ae0ccca60bb4c414de08">operations_research::TimeLimit::ExternalBooleanAsLimit</a></div><div class="ttdeci">std::atomic< bool > * ExternalBooleanAsLimit() const</div><div class="ttdoc">Returns the current external Boolean limit.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00282">time_limit.h:282</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a4c1bbdcb2a449b42a788178d2c3d2477"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a4c1bbdcb2a449b42a788178d2c3d2477">operations_research::TimeLimit::ParallelTimeLimit</a></div><div class="ttdeci">friend class ParallelTimeLimit</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00348">time_limit.h:348</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a4cb3517d59bf4642a85294267736af20"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a4cb3517d59bf4642a85294267736af20">operations_research::TimeLimit::ReadInstructionCounter</a></div><div class="ttdeci">double ReadInstructionCounter()</div><div class="ttdoc">Returns the number of instructions executed since the creation of this object.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00536">time_limit.h:536</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a5b6cf15a55615535aa54e71103de8d9f"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a5b6cf15a55615535aa54e71103de8d9f">operations_research::TimeLimit::RegisterExternalBooleanAsLimit</a></div><div class="ttdeci">void RegisterExternalBooleanAsLimit(std::atomic< bool > *external_boolean_as_limit)</div><div class="ttdoc">Registers the external Boolean to check when LimitReached() is called.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00274">time_limit.h:274</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a75214ecbf18d3e29566c78cac35f699b"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a75214ecbf18d3e29566c78cac35f699b">operations_research::TimeLimit::GetDeterministicLimit</a></div><div class="ttdeci">double GetDeterministicLimit() const</div><div class="ttdoc">Queries the deterministic time limit.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00304">time_limit.h:304</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a764be64f3029f8b8e23511061d8de355"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a764be64f3029f8b8e23511061d8de355">operations_research::TimeLimit::DebugString</a></div><div class="ttdeci">std::string DebugString() const</div><div class="ttdoc">Returns information about the time limit object in a human-readable form.</div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a810d5f7aaf80cc09cf5a094e20c1aaca"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a810d5f7aaf80cc09cf5a094e20c1aaca">operations_research::TimeLimit::LimitReached</a></div><div class="ttdeci">bool LimitReached()</div><div class="ttdoc">Returns true when the external limit is true, or the deterministic time is over the deterministic lim...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00546">time_limit.h:546</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a8e8e386d8f916b1fefb983118cbdf0a6"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a8e8e386d8f916b1fefb983118cbdf0a6">operations_research::TimeLimit::Infinite</a></div><div class="ttdeci">static std::unique_ptr< TimeLimit > Infinite()</div><div class="ttdoc">Creates a time limit object that uses infinite time for wall time, deterministic time and instruction...</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00135">time_limit.h:135</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_a905ec35ba16ac082d3528cf4b6ea9658"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#a905ec35ba16ac082d3528cf4b6ea9658">operations_research::TimeLimit::FromDeterministicTime</a></div><div class="ttdeci">static std::unique_ptr< TimeLimit > FromDeterministicTime(double deterministic_limit)</div><div class="ttdoc">Creates a time limit object that puts limit only on the deterministic time.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00145">time_limit.h:145</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ac056854a98f4094ef4c8d3858b955fef"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ac056854a98f4094ef4c8d3858b955fef">operations_research::TimeLimit::TimeLimit</a></div><div class="ttdeci">TimeLimit(const TimeLimit &)=delete</div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ac62fbbc5383a86a9fe334e3213f6244b"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ac62fbbc5383a86a9fe334e3213f6244b">operations_research::TimeLimit::kHistorySize</a></div><div class="ttdeci">static const int kHistorySize</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00109">time_limit.h:109</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ac7e861414a70fc937d18bc7ca743fc98"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ac7e861414a70fc937d18bc7ca743fc98">operations_research::TimeLimit::GetElapsedDeterministicTime</a></div><div class="ttdeci">double GetElapsedDeterministicTime() const</div><div class="ttdoc">Returns the elapsed deterministic time since the construction of this object.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00261">time_limit.h:261</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ad068edb54c705c548c20e4ba47b4e3a8"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ad068edb54c705c548c20e4ba47b4e3a8">operations_research::TimeLimit::AdvanceDeterministicTime</a></div><div class="ttdeci">void AdvanceDeterministicTime(double deterministic_duration, const char *counter_name)</div><div class="ttdoc">Advances the deterministic time.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00241">time_limit.h:241</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ad0cdf04d71ac4f14262eb4871041ddbd"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ad0cdf04d71ac4f14262eb4871041ddbd">operations_research::TimeLimit::MergeWithGlobalTimeLimit</a></div><div class="ttdeci">void MergeWithGlobalTimeLimit(TimeLimit *other)</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00525">time_limit.h:525</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ad184e7d5cf6d68a6d9b2d32c8dc30c06"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ad184e7d5cf6d68a6d9b2d32c8dc30c06">operations_research::TimeLimit::operator=</a></div><div class="ttdeci">TimeLimit & operator=(const TimeLimit &)=delete</div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_ae3fe2e2b613455b49c6cc74dd3c7581e"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#ae3fe2e2b613455b49c6cc74dd3c7581e">operations_research::TimeLimit::GetElapsedTime</a></div><div class="ttdeci">double GetElapsedTime() const</div><div class="ttdoc">Returns the time elapsed in seconds since the construction of this object.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00252">time_limit.h:252</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_af6b375b546e563ed7e6312123ce9c7a0"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#af6b375b546e563ed7e6312123ce9c7a0">operations_research::TimeLimit::ChangeDeterministicLimit</a></div><div class="ttdeci">void ChangeDeterministicLimit(double new_limit)</div><div class="ttdoc">Overwrites the deterministic time limit with the new value.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00297">time_limit.h:297</a></div></div>
|
|
<div class="ttc" id="aclassoperations__research_1_1_time_limit_html_af90cfd1fc238433fc303ee28c5914eb9"><div class="ttname"><a href="classoperations__research_1_1_time_limit.html#af90cfd1fc238433fc303ee28c5914eb9">operations_research::TimeLimit::AdvanceDeterministicTime</a></div><div class="ttdeci">void AdvanceDeterministicTime(double deterministic_duration)</div><div class="ttdoc">Advances the deterministic time.</div><div class="ttdef"><b>Definition:</b> <a href="time__limit_8h_source.html#l00227">time_limit.h:227</a></div></div>
|
|
<div class="ttc" id="anamespaceoperations__research_html"><div class="ttname"><a href="namespaceoperations__research.html">operations_research</a></div><div class="ttdef"><b>Definition:</b> <a href="cp__model_8h_source.html#l00058">cp_model.h:58</a></div></div>
|
|
<div class="ttc" id="atime__limit_8h_html_aeebe51fb8b5872f6c2e4d01a04af8f78"><div class="ttname"><a href="time__limit_8h.html#aeebe51fb8b5872f6c2e4d01a04af8f78">ABSL_DECLARE_FLAG</a></div><div class="ttdeci">ABSL_DECLARE_FLAG(bool, time_limit_use_usertime)</div><div class="ttdoc">Enables changing the behavior of the TimeLimit class to use -b usertime instead of walltime.</div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
</div>
|
|
</div>
|
|
<div id="footer-container">
|
|
<div id="footer">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|