# Path: csc/divisi/labeled_tensor.py
# class OldDenseLabeledTensor(LabeledView):
# class OldSparseLabeledTensor(LabeledView):
#     def __repr__(self):
#     def __init__(self, *a, **kw):
#     def __repr__(self):
#     def dot(self, other):
#     def array_op(self, ufunc, *others):
#         def take_data(tensor):
#     def slice(self, mode, label):
#     def dense_slice(self, mode, label):
#     def load(cls, filebase):


from csc.divisi.labeled_tensor import SparseLabeledTensor
import time
import os
    import resource
    '''
    return _VmB('VmStk:') - since

def performance_test(thunk, niter=100, print_result=True, test_name=""):
    start_memory = memory()
    start_time = time.time()
    start_cpu = cpu()

    # Just hold a reference to the thing that is returned so it isn't
    # garbage collected. This makes sense for most memory tests
    o = None
    for i in xrange(0, niter):
        o = thunk()

    total_time = time.time() - start_time
    total_cpu = cpu() - start_cpu
    total_memory = memory(start_memory)
    if print_result:
        print test_name, "(%d iterations)" % niter
        print "Total elapsed clock time:", total_time
        print "Per test clock time:", float(total_time) / niter
        print "Total elapsed CPU time:", total_cpu
        print "Per test CPU time:", float(total_cpu) / niter
        print "Memory usage (questionable accuracy due to gc):", total_memory
        print ""

    return total_time, total_cpu, total_memory
performance_test.__test__ = False

def insert_test(num_rows, num_cols):

# Path: csc/divisi/labeled_tensor.py
# class OldDenseLabeledTensor(LabeledView):
# class OldSparseLabeledTensor(LabeledView):
#     def __repr__(self):
#     def __init__(self, *a, **kw):
#     def __repr__(self):
#     def dot(self, other):
#     def array_op(self, ufunc, *others):
#         def take_data(tensor):
#     def slice(self, mode, label):
#     def dense_slice(self, mode, label):
#     def load(cls, filebase):


# Path: test/performance_tests.py
from csc.divisi.labeled_tensor import SparseLabeledTensor
import time
import os
    import resource

    '''
    return _VmB('VmStk:') - since

def performance_test(thunk, niter=100, print_result=True, test_name=""):
    start_memory = memory()
    start_time = time.time()
    start_cpu = cpu()

    # Just hold a reference to the thing that is returned so it isn't
    # garbage collected. This makes sense for most memory tests
    o = None
    for i in xrange(0, niter):
        o = thunk()

    total_time = time.time() - start_time
    total_cpu = cpu() - start_cpu
    total_memory = memory(start_memory)
    if print_result:
        print test_name, "(%d iterations)" % niter
        print "Total elapsed clock time:", total_time
        print "Per test clock time:", float(total_time) / niter
        print "Total elapsed CPU time:", total_cpu
        print "Per test CPU time:", float(total_cpu) / niter
        print "Memory usage (questionable accuracy due to gc):", total_memory
        print ""

    return total_time, total_cpu, total_memory
performance_test.__test__ = False

def insert_test(num_rows, num_cols):

    t = SparseLabeledTensor(ndim = 2)