我运行以下调用 perf_event_open 系统调用的程序:Linux sama-desktop 3.18.0-20-rpi2 #21-Ubuntu SMP PREEMPT Sun Apr 5 01:56:02 UTC 2015 armv7l armv7l armv7l GNU/Linux
该程序:
#define _GNU_SOURCE 1
#include <asm/unistd.h>
#include <fcntl.h>
#include <linux/perf_event.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long perf_event_open(struct perf_event_attr* event_attr, pid_t pid, int cpu, int group_fd, unsigned long flags)
{
return syscall(__NR_perf_event_open, event_attr, pid, cpu, group_fd, flags);
}
static void perf_event_handler(int signum, siginfo_t* info, void* ucontext) {
if(info->si_code != POLL_HUP) {
// Only POLL_HUP should happen.
exit(EXIT_FAILURE);
}
ioctl(info->si_fd, PERF_EVENT_IOC_REFRESH, …Run Code Online (Sandbox Code Playgroud) 我是python中的新手,我正在尝试在python的另一个字符串中剪切一段字符串.我看了其他类似的问题,但我找不到答案.
我有一个变量,其中包含域列表,域名如下所示:
http://92.230.38.21/ios/Channel767/Hotbird.mp3 http://92.230.38.21/ios/Channel9798/Coldbird.mp3
....
我想要mp3文件名(在这个例子中Hotbird,Coldbird等)
我知道我必须能够使用re.findall()来完成它,但我不知道我需要使用的正则表达式.
任何的想法?
更新:这是我使用的部分:
for final in match2:
netname=re.findall('\W+\//\W+\/\W+\/\W+\/\W+', final)
print final
print netname
Run Code Online (Sandbox Code Playgroud)
哪个没用.然后我尝试这样做只削减IP地址(92.230.28.21)而不是名称:
for final in match2:
netname=re.findall('\d+\.\d+\.\d+\.\d+', final)
print final
Run Code Online (Sandbox Code Playgroud) 我想将多个C文件编译为单个汇编文件(它们是互连的,当您编译它时,您将有一个二进制文件).GCC有可能吗?
例如,看看这个回购.make文件将生成一个文件(二进制文件).
但是我想将它们编译为汇编,检测代码然后将它们编译为二进制文件.显然,如果我将所有汇编文件放在一个*.s文件中,对我来说会更容易.
任何的想法?
arm ×1
assembly ×1
c ×1
compilation ×1
gcc ×1
linux ×1
perf ×1
python ×1
regex ×1
system-calls ×1