IMP logo
IMP Reference Guide  develop.345e71cb9a,2026/08/10
The Integrative Modeling Platform
benchmark/__init__.py
1 # This file was automatically generated by SWIG (https://www.swig.org).
2 # Version 4.5.0
3 #
4 # Do not make changes to this file unless you know what you are doing - modify
5 # the SWIG interface file instead.
6 
7 
8 # This wrapper is part of IMP,
9 # Copyright 2007-2026 IMP Inventors. All rights reserved.
10 
11 
12 
13 
14 import typing
15 import _IMP_benchmark
16 
17 import builtins as __builtin__
18 
19 def _swig_repr(self):
20  try:
21  strthis = "proxy of " + self.this.__repr__()
22  except __builtin__.Exception:
23  strthis = ""
24  return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
25 
26 
27 def _swig_setattr_nondynamic_instance_variable(set):
28  def set_instance_attr(self, name, value):
29  if name == "this":
30  set(self, name, value)
31  elif name == "thisown":
32  self.this.own(value)
33  elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
34  set(self, name, value)
35  else:
36  raise AttributeError("You cannot add instance attributes to %s" % self)
37  return set_instance_attr
38 
39 
40 def _swig_setattr_nondynamic_class_variable(set):
41  def set_class_attr(cls, name, value):
42  if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
43  set(cls, name, value)
44  else:
45  raise AttributeError("You cannot add class attributes to %s" % cls)
46  return set_class_attr
47 
48 
49 class _SwigNonDynamicMeta(type):
50  """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
51  __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
52 
53 
54 import weakref
55 
56 class IMP_BENCHMARK_SwigPyIterator(object):
57  r"""Proxy of C++ swig::IMP_BENCHMARK_SwigPyIterator class."""
58 
59  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
60 
61  def __init__(self, *args, **kwargs):
62  raise AttributeError("No constructor defined - class is abstract")
63  __repr__ = _swig_repr
64  __swig_destroy__ = _IMP_benchmark.delete_IMP_BENCHMARK_SwigPyIterator
65 
66  def value(self):
67  r"""value(IMP_BENCHMARK_SwigPyIterator self) -> PyObject *"""
68  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_value(self)
69 
70  def incr(self, n=1):
71  r"""incr(IMP_BENCHMARK_SwigPyIterator self, size_t n=1) -> IMP_BENCHMARK_SwigPyIterator"""
72  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_incr(self, n)
73 
74  def decr(self, n=1):
75  r"""decr(IMP_BENCHMARK_SwigPyIterator self, size_t n=1) -> IMP_BENCHMARK_SwigPyIterator"""
76  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_decr(self, n)
77 
78  def distance(self, x):
79  r"""distance(IMP_BENCHMARK_SwigPyIterator self, IMP_BENCHMARK_SwigPyIterator x) -> ptrdiff_t"""
80  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_distance(self, x)
81 
82  def equal(self, x):
83  r"""equal(IMP_BENCHMARK_SwigPyIterator self, IMP_BENCHMARK_SwigPyIterator x) -> bool"""
84  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_equal(self, x)
85 
86  def copy(self):
87  r"""copy(IMP_BENCHMARK_SwigPyIterator self) -> IMP_BENCHMARK_SwigPyIterator"""
88  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_copy(self)
89 
90  def __next__(self):
91  r"""__next__(IMP_BENCHMARK_SwigPyIterator self) -> PyObject *"""
92  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___next__(self)
93 
94  def previous(self):
95  r"""previous(IMP_BENCHMARK_SwigPyIterator self) -> PyObject *"""
96  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_previous(self)
97 
98  def advance(self, n):
99  r"""advance(IMP_BENCHMARK_SwigPyIterator self, ptrdiff_t n) -> IMP_BENCHMARK_SwigPyIterator"""
100  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_advance(self, n)
101 
102  def __eq__(self, x):
103  r"""__eq__(IMP_BENCHMARK_SwigPyIterator self, IMP_BENCHMARK_SwigPyIterator x) -> bool"""
104  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___eq__(self, x)
105 
106  def __ne__(self, x):
107  r"""__ne__(IMP_BENCHMARK_SwigPyIterator self, IMP_BENCHMARK_SwigPyIterator x) -> bool"""
108  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___ne__(self, x)
109 
110  def __iadd__(self, n):
111  r"""__iadd__(IMP_BENCHMARK_SwigPyIterator self, ptrdiff_t n) -> IMP_BENCHMARK_SwigPyIterator"""
112  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___iadd__(self, n)
113 
114  def __isub__(self, n):
115  r"""__isub__(IMP_BENCHMARK_SwigPyIterator self, ptrdiff_t n) -> IMP_BENCHMARK_SwigPyIterator"""
116  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___isub__(self, n)
117 
118  def __add__(self, n):
119  r"""__add__(IMP_BENCHMARK_SwigPyIterator self, ptrdiff_t n) -> IMP_BENCHMARK_SwigPyIterator"""
120  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___add__(self, n)
121 
122  def __sub__(self, *args):
123  r"""
124  __sub__(IMP_BENCHMARK_SwigPyIterator self, ptrdiff_t n) -> IMP_BENCHMARK_SwigPyIterator
125  __sub__(IMP_BENCHMARK_SwigPyIterator self, IMP_BENCHMARK_SwigPyIterator x) -> ptrdiff_t
126  """
127  return _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator___sub__(self, *args)
128  def __iter__(self):
129  return self
130 
131 # Register IMP_BENCHMARK_SwigPyIterator in _IMP_benchmark:
132 _IMP_benchmark.IMP_BENCHMARK_SwigPyIterator_swigregister(IMP_BENCHMARK_SwigPyIterator)
133 
134 _value_types=[]
135 _object_types=[]
136 _raii_types=[]
137 _plural_types=[]
138 
139 IMP_DEBUG = _IMP_benchmark.IMP_DEBUG
140 
141 IMP_RELEASE = _IMP_benchmark.IMP_RELEASE
142 
143 IMP_SILENT = _IMP_benchmark.IMP_SILENT
144 
145 IMP_PROGRESS = _IMP_benchmark.IMP_PROGRESS
146 
147 IMP_TERSE = _IMP_benchmark.IMP_TERSE
148 
149 IMP_VERBOSE = _IMP_benchmark.IMP_VERBOSE
150 
151 IMP_MEMORY = _IMP_benchmark.IMP_MEMORY
152 
153 IMP_NONE = _IMP_benchmark.IMP_NONE
154 
155 IMP_USAGE = _IMP_benchmark.IMP_USAGE
156 
157 IMP_INTERNAL = _IMP_benchmark.IMP_INTERNAL
158 
159 IMP_KERNEL_HAS_LOG4CXX = _IMP_benchmark.IMP_KERNEL_HAS_LOG4CXX
160 
161 IMP_COMPILER_HAS_CEREAL_RAW_POINTER = _IMP_benchmark.IMP_COMPILER_HAS_CEREAL_RAW_POINTER
162 
163 IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_benchmark.IMP_COMPILER_HAS_DEBUG_VECTOR
164 
165 IMP_COMPILER_HAS_RANDOM_SHUFFLE = _IMP_benchmark.IMP_COMPILER_HAS_RANDOM_SHUFFLE
166 
167 IMP_COMPILER_HAS_THREE_WAY = _IMP_benchmark.IMP_COMPILER_HAS_THREE_WAY
168 
169 IMP_KERNEL_HAS_BOOST_RANDOM = _IMP_benchmark.IMP_KERNEL_HAS_BOOST_RANDOM
170 
171 IMP_KERNEL_HAS_NUMPY = _IMP_benchmark.IMP_KERNEL_HAS_NUMPY
172 
173 IMP_KERNEL_HAS_BOOST_SYSTEM = _IMP_benchmark.IMP_KERNEL_HAS_BOOST_SYSTEM
174 
175 IMP_KERNEL_HAS_GPERFTOOLS = _IMP_benchmark.IMP_KERNEL_HAS_GPERFTOOLS
176 
177 IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER = _IMP_benchmark.IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER
178 
179 IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER = _IMP_benchmark.IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER
180 
181 IMPKERNEL_SHOW_WARNINGS = _IMP_benchmark.IMPKERNEL_SHOW_WARNINGS
182 
183 
184 import sys
185 class _DirectorObjects:
186  """@internal Simple class to keep references to director objects
187  to prevent premature deletion."""
188  def __init__(self):
189  self._objects = []
190  def register(self, obj):
191  """Take a reference to a director object; will only work for
192  refcounted C++ classes"""
193  if hasattr(obj, 'get_ref_count'):
194  self._objects.append(obj)
195  def cleanup(self):
196  """Only drop our reference and allow cleanup by Python if no other
197  Python references exist (we hold 3 references: one in self._objects,
198  one in x, and one in the argument list for getrefcount) *and* no
199  other C++ references exist (the Python object always holds one)"""
200  objs = [x for x in self._objects if sys.getrefcount(x) > 3 \
201  or x.get_ref_count() > 1]
202 # Do in two steps so the references are kept until the end of the
203 # function (deleting references may trigger a fresh call to this method)
204  self._objects = objs
205  def get_object_count(self):
206  """Get number of director objects (useful for testing only)"""
207  return len(self._objects)
208 _director_objects = _DirectorObjects()
209 
210 class _ostream(object):
211  r"""Proxy of C++ std::ostream class."""
212 
213  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
214 
215  def __init__(self, *args, **kwargs):
216  raise AttributeError("No constructor defined")
217  __repr__ = _swig_repr
218 
219  def write(self, osa_buf):
220  r"""write(_ostream self, char const * osa_buf)"""
221  return _IMP_benchmark._ostream_write(self, osa_buf)
222 
223 # Register _ostream in _IMP_benchmark:
224 _IMP_benchmark._ostream_swigregister(_ostream)
225 IMP_C_OPEN_BINARY = _IMP_benchmark.IMP_C_OPEN_BINARY
226 
227 import IMP
228 IMP_BENCHMARK_HAS_BOOST_FILESYSTEM = _IMP_benchmark.IMP_BENCHMARK_HAS_BOOST_FILESYSTEM
229 
230 IMP_BENCHMARK_HAS_BOOST_PROGRAMOPTIONS = _IMP_benchmark.IMP_BENCHMARK_HAS_BOOST_PROGRAMOPTIONS
231 
232 IMP_BENCHMARK_HAS_BOOST_RANDOM = _IMP_benchmark.IMP_BENCHMARK_HAS_BOOST_RANDOM
233 
234 IMP_BENCHMARK_HAS_NUMPY = _IMP_benchmark.IMP_BENCHMARK_HAS_NUMPY
235 
236 IMPBENCHMARK_SHOW_WARNINGS = _IMP_benchmark.IMPBENCHMARK_SHOW_WARNINGS
237 
238 
239 _raii_types.append("Profiler")
240 
241 
242 def report(*args):
243  r"""
244  report(std::string benchmark, std::string algorithm, double time, double check)
245  report(std::string benchmark, double time, double check)
246  """
247  return _IMP_benchmark.report(*args)
248 
249 def get_return_value():
250  r"""get_return_value() -> int"""
251  return _IMP_benchmark.get_return_value()
252 class Profiler(IMP._RAII):
253  r"""Proxy of C++ IMP::benchmark::Profiler class."""
254 
255  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
256 
257  def __init__(self, *args):
258  r"""
259  __init__(Profiler self) -> Profiler
260  __init__(Profiler self, std::string name) -> Profiler
261  """
262  _IMP_benchmark.Profiler_swiginit(self, _IMP_benchmark.new_Profiler(*args))
263 
264  def set(self, name):
265  r"""set(Profiler self, std::string name)"""
266  return _IMP_benchmark.Profiler_set(self, name)
267 
268  def reset(self):
269  r"""reset(Profiler self)"""
270  return _IMP_benchmark.Profiler_reset(self)
271  __swig_destroy__ = _IMP_benchmark.delete_Profiler
272 
273  def show(self, *args):
274  r"""show(Profiler self, _ostream out=std::cout)"""
275  return _IMP_benchmark.Profiler_show(self, *args)
276 
277  def __enter__(self):
278  return self
279  def __exit__(self, exc_type, exc_val, exc_tb):
280  self.reset()
281  return False
282 
283 
284  def __str__(self):
285  r"""__str__(Profiler self) -> std::string"""
286  return _IMP_benchmark.Profiler___str__(self)
287 
288  def __repr__(self):
289  r"""__repr__(Profiler self) -> std::string"""
290  return _IMP_benchmark.Profiler___repr__(self)
291 
292 # Register Profiler in _IMP_benchmark:
293 _IMP_benchmark.Profiler_swigregister(Profiler)
294 
295 def get_module_name():
296  r"""get_module_name() -> std::string const"""
297  return _IMP_benchmark.get_module_name()
298 
299 def get_module_version():
300  r"""get_module_version() -> std::string const"""
301  return _IMP_benchmark.get_module_version()
302 
303 def get_example_path(fname):
304  r"""get_example_path(std::string fname) -> std::string"""
305  return _IMP_benchmark.get_example_path(fname)
306 
307 def get_data_path(fname):
308  r"""get_data_path(std::string fname) -> std::string"""
309  return _IMP_benchmark.get_data_path(fname)
310 
311 from . import _version_check
312 _version_check.check_version(get_module_version())
313 __version__ = get_module_version()
314 
315 
void report(std::string benchmark, std::string algorithm, double time, double check)
Report a benchmark result in a standard way.
std::string get_data_path(std::string file_name)
Return the full path to one of this module's data files.
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
std::string get_module_version()
Return the version of this module, as a string.