Sample to get CPU information

mt6582 cpuinfo:
1|root@scofieldt:/proc # cat cpuinfo
cat cpuinfo
Processor : ARMv7 Processor rev 3 (v7l)
processor : 0
BogoMIPS : 26.00
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 3


Processor : ARMv7 Processor rev 3 (v7l)
processor : 1
BogoMIPS : 26.00
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 3


Hardware : MT6582
Revision : 0000
Serial : 0000000000000000
root@scofieldt:/proc #
我是一个嵌入式新人,导师让我使用串口板进行调试(实际完全不知道怎么做),我连接登录进自研系统,help给出。nvt@na51089: help ? - alias for 'help' base - print or set address offset bdinfo - print Board Info structure blkcache - block cache diagnostics and control bootm - boot application image from memory bootp - boot image via network using BOOTP/TFTP protocol chpart - change active partition cmp - memory compare cp - memory copy crc32 - checksum calculation dhcp - boot image via network using DHCP/TFTP protocol env - environment handling commands exit - exit script false - do nothing, unsuccessfully fatinfo - print information about filesystem fatload - load binary file from a dos filesystem fatls - list files in a directory (default /) fatmkdir - create a directory fatrm - delete a file fatsize - determine a file's size fatwrite - write file into a dos filesystem fdt - flattened device tree utility commands go - start application at address 'addr' gpio - query and control gpio pins help - print command description/usage httpd - httpd - start www server for firmware recovery loop - infinite loop on address range md - memory display md5sum - compute MD5 message digest mm - memory modify (auto-incrementing address) mmc - MMC sub system mmcinfo - display MMC info mtdparts - define flash/nand partitions mw - memory write (fill) nand - NAND sub-system nboot - boot from NAND device nm - memory modify (constant address) nvt_boot - To do nvt platform boot init. nvt_cpu_freq- change cpu freq nvt_encrypt- To encrypt via key manager sample nvt_get_cpu_freq- get cpu freq nvt_get_ddr_freq- get ddr freq/type nvt_jtag_disable- jtag disable nvt_key_set_engine_right- To read key set X nvt_read_key_set- To read key set X nvt_read_lock- To let key set X un-readable nvt_rtos_disable- To disable uboot boot rtos nvt_secure_en- secure enable related API nvt_uart_disable- To disable uart print nvt_write_key- To write key via OTP sample ping - send ICMP ECHO_REQUEST to network host printenv - print environment variables pwm - nvt pwm operation reset - Perform RESET of the CPU setenv - set environment variables showvar - print local hushshell variables test - minimal test like /bin/sh tftpboot - boot image via network using TFTP protocol true - do nothing, successfully ubi - ubi commands version - print monitor, compiler and linker version
09-19
import sys sys.path.append("src") import util import random random.seed(42) import RNA from metric_helper.alignment_mi_metric import calc_MItable from Bio import AlignIO, Align from Bio.Alphabet import generic_rna def calc_information_content(stockholm, cpu, n_samples = float("inf")): """ get mutual information according to refseq/SS_cons """ align = AlignIO.read(stockholm, "stockholm", alphabet=generic_rna) if n_samples < len(align): print(f"sampling {n_samples} records from {stockholm}") align = Align.MultipleSeqAlignment( random.sample(list(align), int(n_samples)), column_annotations = align.column_annotations ) # calculate seq entropy based on #GC RF unmasked_col = [i if n in "AUCGT" else -1 for i,n in enumerate(align.column_annotations["reference_annotation"].upper())] bptable_1st = [len(unmasked_col)] bptable_1st += [i+1 for i in unmasked_col] # calculate 2/3 deg information based on #GC SS_cons _, ss_cons, _, _ = util.load_stk(stockholm) bptable_2nd = RNA.pt_pk_remove(RNA.ptable_from_string(ss_cons)) bptable_all = RNA.ptable_from_string(ss_cons) mi_1st = calc_MItable(align, bptable_1st, cpu = cpu) info_1st = mi_1st.sum() mi_2nd = calc_MItable(align, bptable_2nd, cpu = cpu) info_2nd = mi_2nd.sum() mi_all = calc_MItable(align, bptable_all, cpu = cpu) info_all = mi_all.sum() info_3rd = info_all - info_2nd return ss_cons, mi_1st+mi_all, info_1st, info_2nd, info_3rd if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument('--stockholm', '-i') parser.add_argument('--cpu', default = 4, type = int) parser.add_argument('--n_samples', default = "", type = str) args = parser.parse_args() n_samples = float("inf") if args.n_samples == "" else int(args.n_samples) _, _, info_1st, info_2nd, info_3rd = calc_information_content(args.stockholm, args.cpu, n_samples = n_samples) print(f"{args.stockholm},{info_1st:.3f},{info_2nd:.3f},{info_3rd:.3f}")逐行解析代码
最新发布
10-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值