我正在使用该perf工具的 4.1 内核和 4.1 版运行 debian 测试。在这个版本中,他们似乎添加了某种保护,以防止普通用户从该工具收集数据。因此,perf以普通用户身份运行会出现此错误:
perf stat ls
Error:
You may not have permission to collect stats.
Consider tweaking /proc/sys/kernel/perf_event_paranoid:
-1 - Not paranoid at all
0 - Disallow raw tracepoint access for unpriv
1 - Disallow cpu events for unpriv
2 - Disallow kernel profiling for unpriv
Run Code Online (Sandbox Code Playgroud)
perf_event_paranoid在我的安装中包含 3 个。不幸的是,即使以 root 身份我也无法更改该文件。如何允许我自己的用户在perf没有 sudo 权限的情况下使用?
我有一个应用程序,我想对其进行基准测试,它不需要 root 并且我不想以 root 身份运行它来对其进行基准测试。
我在~/.config/systemd/user工作中登录时创建了以下服务文件来备份我的工作数据。
[Unit]
Description=Backup Work Related Files
[Service]
Type=oneshot
ExecStartPre=/usr/bin/ping -c 1 -W 1 xxx
ExecStart=/usr/bin/rsync -avzuhH --progress --delete --exclude=.Trash-1000 /some/folder/ xxx@xxx:Documents/backup
ExecStart=/usr/bin/rsync -avzuhH --progress file xxx@xxx:Documents/backup/file
Run Code Online (Sandbox Code Playgroud)
我可以用 找到服务,systemctl --user list-unit-files我也可以用 开始服务systemctl --user start backup_work.service。出于某种原因,虽然我无法使用journalctl --user -u backup_work.service. 我在日志中正常查看时会看到 rsync 和 ping 的日志,但无法过滤到我的服务文件。
我需要在服务文件中更改某些内容吗?