Esempio n. 1
0
def get_clock_info(name):
    if not isinstance(name, str):
        raise (TypeError("argument 1 must be str, not int"))

    # cpython gives resolution 1e-9 in some cases,
    # but jdks System.nanoTime() does not guarantee that
    resolution = 1e-6
    if name == 'monotonic':
        adjustable = False
        implementation = "monotonic"
        monotonic = True
    elif name == 'perf_counter':
        adjustable = False
        implementation = "perf_counter"
        monotonic = True
    elif name == 'process_time':
        adjustable = False
        implementation = "process_time"
        monotonic = True
    elif name == 'thread_time':
        adjustable = False
        implementation = "thread_time"
        monotonic = True
    elif name == 'time':
        adjustable = True
        implementation = "time"
        monotonic = False
    else:
        raise (ValueError("unknown clock"))

    result = SimpleNamespace(adjustable=adjustable,
                             implementation=implementation,
                             monotonic=monotonic,
                             resolution=resolution)
    return result
Esempio n. 2
0
def make_implementation_info():
    from _descriptor import SimpleNamespace, make_named_tuple_class
    version_info_type = make_named_tuple_class(
        "version_info", ["major", "minor", "micro", "releaselevel", "serial"])
    return SimpleNamespace(name="graalpython",
                           cache_tag="graalpython",
                           version=version_info_type(version_info),
                           _multiarch=__gmultiarch)
Esempio n. 3
0
def make_implementation_info():
    from _descriptor import SimpleNamespace
    result = SimpleNamespace(name="graalpython",
                             cache_tag="graalpython-" +
                             str(version_info.major) + str(version_info.minor),
                             version=version_info,
                             _multiarch=__gmultiarch)
    return result
Esempio n. 4
0
def make_implementation_info():
    from _descriptor import SimpleNamespace, make_named_tuple_class
    version_info_type = make_named_tuple_class(
        "version_info", ["major", "minor", "micro", "releaselevel", "serial"])
    _version = version_info_type(version_info)
    result = SimpleNamespace(name="graalpython",
                             cache_tag="graalpython-" + str(_version.major) +
                             str(_version.minor),
                             version=_version,
                             _multiarch=__gmultiarch)
    version_info_type.seal()
    return result