|
|
@ -140,8 +140,13 @@ def get_bar(bar_ratio, max_len, color=False): |
|
|
|
assert 0 <= bar_ratio <= 1 |
|
|
|
res = [] |
|
|
|
used_len = int(bar_ratio * max_len) |
|
|
|
res.append('|' * used_len) |
|
|
|
res.append(' ' * (max_len-used_len)) |
|
|
|
res.extend(['|'] * used_len) |
|
|
|
res.extend([' '] * (max_len-used_len)) |
|
|
|
|
|
|
|
if color: |
|
|
|
res.insert(int(max_len*0.4), COLOR_YELLOW) |
|
|
|
res.insert(int(max_len*0.8)+1, f'{END_COLOR}{COLOR_RED}') |
|
|
|
res.append(END_COLOR) |
|
|
|
|
|
|
|
return ''.join(res) |
|
|
|
|
|
|
@ -253,11 +258,11 @@ def print_table_res(data_list): |
|
|
|
str_list.append(table_icon['vline']) |
|
|
|
|
|
|
|
# 显存进度条 |
|
|
|
str_list.append(get_bar(used_mem/total_mem, cell_width_list[2])) |
|
|
|
str_list.append(get_bar(used_mem/total_mem, cell_width_list[2], True)) |
|
|
|
str_list.append(table_icon['vline']) |
|
|
|
|
|
|
|
# 利用率进度条 |
|
|
|
str_list.append(get_bar(util_gpu/100, cell_width_list[3])) |
|
|
|
str_list.append(get_bar(util_gpu/100, cell_width_list[3], True)) |
|
|
|
str_list.append(table_icon['vline']) |
|
|
|
|
|
|
|
print(''.join(str_list)) |
|
|
|