Esempio n. 1
0
def cache_memory_stats(ibs, cid_list, fnum=None):
    logger.info('[dev stats] cache_memory_stats()')
    # kpts_list = ibs.get_annot_kpts(cid_list)
    # desc_list = ibs.get_annot_vecs(cid_list)
    # nFeats_list = map(len, kpts_list)
    gx_list = np.unique(ibs.cx2_gx(cid_list))

    bytes_map = {
        'chip dbytes': [ut.file_bytes(fpath) for fpath in ibs.get_rchip_path(cid_list)],
        'img dbytes': [
            ut.file_bytes(gpath) for gpath in ibs.gx2_gname(gx_list, full=True)
        ],
        # 'flann dbytes':  ut.file_bytes(flann_fpath),
    }

    byte_units = {
        'GB': 2 ** 30,
        'MB': 2 ** 20,
        'KB': 2 ** 10,
    }

    tabular_body_list = []

    convert_to = 'KB'
    for key, val in six.iteritems(bytes_map):
        key2 = key.replace('bytes', convert_to)
        if isinstance(val, list):
            val2 = [bytes_ / byte_units[convert_to] for bytes_ in val]
            tex_str = ut.util_latex.latex_get_stats(key2, val2)
        else:
            val2 = val / byte_units[convert_to]
            tex_str = ut.util_latex.latex_scalar(key2, val2)
        tabular_body_list.append(tex_str)

    tabular = ut.util_latex.tabular_join(tabular_body_list)

    logger.info(tabular)
    ut.util_latex.render(tabular)

    if fnum is None:
        fnum = 0

    return fnum + 1
Esempio n. 2
0
def cache_memory_stats(ibs, cid_list, fnum=None):
    from util import util_latex as latex_formater
    print('[dev stats] cache_memory_stats()')
    #kpts_list = ibs.get_annot_kpts(cid_list)
    #desc_list = ibs.get_annot_desc(cid_list)
    #nFeats_list = map(len, kpts_list)
    gx_list = np.unique(ibs.cx2_gx(cid_list))

    bytes_map = {
        'chip dbytes': [utool.file_bytes(fpath) for fpath in ibs.get_rchip_path(cid_list)],
        'img dbytes':  [utool.file_bytes(gpath) for gpath in ibs.gx2_gname(gx_list, full=True)],
        #'flann dbytes':  utool.file_bytes(flann_fpath),
    }

    byte_units = {
        'GB': 2 ** 30,
        'MB': 2 ** 20,
        'KB': 2 ** 10,
    }

    tabular_body_list = [
    ]

    convert_to = 'KB'
    for key, val in six.iteritems(bytes_map):
        key2 = key.replace('bytes', convert_to)
        if isinstance(val, list):
            val2 = [bytes_ / byte_units[convert_to] for bytes_ in val]
            tex_str = latex_formater.latex_mystats(key2, val2)
        else:
            val2 = val / byte_units[convert_to]
            tex_str = latex_formater.latex_scalar(key2, val2)
        tabular_body_list.append(tex_str)

    tabular = latex_formater.tabular_join(tabular_body_list)

    print(tabular)
    latex_formater.render(tabular)

    if fnum is None:
        fnum = 0

    return fnum + 1
Esempio n. 3
0
 def cache_bytes(qres, qresdir):
     """ Size of the cached query result on disk """
     fpath  = qres.get_fpath(qresdir)
     nBytes = ut.file_bytes(fpath)
     return nBytes
Esempio n. 4
0
 def cache_bytes(qres, qresdir):
     """ Size of the cached query result on disk """
     fpath  = qres.get_fpath(qresdir)
     nBytes = ut.file_bytes(fpath)
     return nBytes
Esempio n. 5
0
 def tryread_nbytes(fpath):
     try:
         return ut.file_bytes(fpath)
     except SystemErrors:
         return np.nan
Esempio n. 6
0
 def tryread_nbytes(fpath):
     try:
         return ut.file_bytes(fpath)
     except SystemErrors:
         return np.nan