cengal.time_management.cpu_clock.versions.v_0.cpu_clock
1#!/usr/bin/env python 2# coding=utf-8 3 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18 19__all__ = ['cpu_clock', 'perf_counter', 'cpu_clock_cycles', 'CPU_TICKS_PER_SECOND'] 20 21 22""" 23Module Docstring 24Docstrings: http://www.python.org/dev/peps/pep-0257/ 25""" 26 27__author__ = "ButenkoMS <gtalk@butenkoms.space>" 28__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>" 29__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ] 30__license__ = "Apache License, Version 2.0" 31__version__ = "4.4.1" 32__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>" 33__email__ = "gtalk@butenkoms.space" 34# __status__ = "Prototype" 35__status__ = "Development" 36# __status__ = "Production" 37 38 39try: 40 from cengal.time_management.cpu_clock_cycles.versions.v_0.compilable.cpu_clock_cycles__cython import cpu_clock_cycles, set_cycles_per_second 41 from cengal.hardware.info.cpu import cpu_info 42 43 44 CPU_TICKS_PER_SECOND = cpu_info().hz_advertised[0] 45 46 47 if 0 == CPU_TICKS_PER_SECOND: 48 from time import perf_counter 49 cpu_clock = perf_counter 50 else: 51 set_cycles_per_second(CPU_TICKS_PER_SECOND) 52 from cengal.time_management.cpu_clock_cycles.versions.v_0.compilable.cpu_clock_cycles__cython import perf_counter, cpu_clock 53 54except ImportError: 55 from time import perf_counter 56 57 CPU_TICKS_PER_SECOND = 0 58 59 cpu_clock = perf_counter 60 61 def cpu_clock_cycles(): 62 return 0
def
cpu_clock():
def
perf_counter():
def
cpu_clock_cycles():
CPU_TICKS_PER_SECOND =
3400000000