高精度打点计时-纳米级
C++ chrono库-个人博客
Python time库-csdn
std::cout << "0 被计时代码耗时:" << dur.count() << " 纳秒" << std::endl;
std::cout << "1 被计时代码耗时:" << std::chrono::duration_cast<std::chrono::nanoseconds>(dur).count() << " 纳秒" << std::endl;
std::cout << "2 被计时代码耗时:" << std::chrono::duration_cast<std::chrono::microseconds>(dur).count() << " 微妙" << std::endl;
std::cout << "3 被计时代码耗时:" << std::chrono::duration_cast<std::chrono::milliseconds>(dur).count() << " 毫秒" << std::endl;
std::cout << "4 被计时代码耗时:" << std::chrono::duration_cast<std::chrono::seconds>(dur).count() << " 秒钟" << std::endl;
std::cout << "5 被计时代码耗时:" << std::chrono::duration_cast<std::chrono::minutes>(dur).count() << " 分钟" << std::endl;
std::cout << "6 被计时代码耗时:" << std::chrono::duration_cast<std::chrono::hours>(dur).count() << " 小时" << std::endl;
t0 = time.perf_counter_ns()
# 待测代码
t1 = time.perf_counter_ns()
spend_time = t1 - t0
print("The matmul of numpy run time: \n", spend_time)
挂载硬盘
# 查看当前各磁盘分区情况
lsblk
# 创建文件
mkdir data
# 格式化硬盘
mkfs -t ext4 /dev/sda
# 挂载硬盘
mount /dev/sda /data
linux配置超时不操作自动退出登录TMOUT
vi /etc/profile
#打开文件后,在末尾增加下面两行内容,然后保存退出。
export TMOUT=0
#0代表永不自动退出
readonly TMOUT
# 将值设置为readonly 防止用户更改,在shell中无法修改TMOUT
git unable to access
export GIT_SSL_NO_VERIFY=true
git config --global http.sslVerify "false"