# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())
# 
# def generate_uuid():
#     return str(uuid.uuid4())
# 
# def generate_sha1(text):
#     sha1_hash = hashlib.sha1()
#     sha1_hash.update(text.encode('utf-8'))
#     return sha1_hash.hexdigest()


import threading
import random
import math
from .utils import timestamp, generate_uuid, generate_sha1
    NAME_CPU_TIME = 'CPU time'
    NAME_CPU_USAGE = 'CPU usage'
    NAME_MAIN_THREAD_CPU_USAGE = 'Main thread CPU usage'
    NAME_MAX_RSS = 'Max RSS'
    NAME_CURRENT_RSS = 'Current RSS'
    NAME_VM_SIZE = 'VM Size'
    NAME_GC_COUNT = 'Uncollected objects'
    NAME_GC_COLLECTIONS = 'Collections'
    NAME_GC_COLLECTED = 'Collected objects'
    NAME_GC_UNCOLLECTABLE = 'Uncollectable objects'
    NAME_THREAD_COUNT = 'Active threads'
    NAME_UNCOLLECTED_ALLOCATIONS = 'Uncollected allocations'
    NAME_BLOCKING_CALL_TIMES = 'Blocking call times'
    NAME_HANDLED_EXCEPTIONS = 'Handled exceptions'
    NAME_TF_OPERATION_TIMES = 'TensorFlow operation times'
    NAME_TF_OPERATION_ALLOCATION_RATE = 'TensorFlow operation allocation rate'
    
    UNIT_NONE = ''
    UNIT_MILLISECOND = 'millisecond'
    UNIT_MICROSECOND = 'microsecond'
    UNIT_NANOSECOND = 'nanosecond'
    UNIT_BYTE = 'byte'
    UNIT_KILOBYTE = 'kilobyte'
    UNIT_PERCENT = 'percent'

    TRIGGER_TIMER = 'timer'
    TRIGGER_API = 'api'


    def __init__(self, agent, typ, category, name, unit):

# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())
# 
# def generate_uuid():
#     return str(uuid.uuid4())
# 
# def generate_sha1(text):
#     sha1_hash = hashlib.sha1()
#     sha1_hash.update(text.encode('utf-8'))
#     return sha1_hash.hexdigest()


# Path: stackimpact/metric.py
import threading
import random
import math
from .utils import timestamp, generate_uuid, generate_sha1

    NAME_CPU_TIME = 'CPU time'
    NAME_CPU_USAGE = 'CPU usage'
    NAME_MAIN_THREAD_CPU_USAGE = 'Main thread CPU usage'
    NAME_MAX_RSS = 'Max RSS'
    NAME_CURRENT_RSS = 'Current RSS'
    NAME_VM_SIZE = 'VM Size'
    NAME_GC_COUNT = 'Uncollected objects'
    NAME_GC_COLLECTIONS = 'Collections'
    NAME_GC_COLLECTED = 'Collected objects'
    NAME_GC_UNCOLLECTABLE = 'Uncollectable objects'
    NAME_THREAD_COUNT = 'Active threads'
    NAME_UNCOLLECTED_ALLOCATIONS = 'Uncollected allocations'
    NAME_BLOCKING_CALL_TIMES = 'Blocking call times'
    NAME_HANDLED_EXCEPTIONS = 'Handled exceptions'
    NAME_TF_OPERATION_TIMES = 'TensorFlow operation times'
    NAME_TF_OPERATION_ALLOCATION_RATE = 'TensorFlow operation allocation rate'
    
    UNIT_NONE = ''
    UNIT_MILLISECOND = 'millisecond'
    UNIT_MICROSECOND = 'microsecond'
    UNIT_NANOSECOND = 'nanosecond'
    UNIT_BYTE = 'byte'
    UNIT_KILOBYTE = 'kilobyte'
    UNIT_PERCENT = 'percent'

    TRIGGER_TIMER = 'timer'
    TRIGGER_API = 'api'


    def __init__(self, agent, typ, category, name, unit):

        metric_id = generate_sha1("{0}{1}{2}{3}{4}{5}{6}".format(