1 Star 1 Fork 2

OpenCloudOS / perf-prof

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
GPL-2.0

基于perf的监控框架

基于libperflibtraceevent库实现简单的监控框架,提供比perf更灵活的特性。

  • 数据不落盘。
  • 数据过滤,基于tracepoint的过滤机制,减少数据量。
  • 数据实时处理并输出。不需要存盘后再处理。
  • 基于perf_event_open系统调用。

虽然比perf更灵活,但不能替代perf。perf灵活的符号处理,支持大量的event,支持很多硬件PMU特性。

perf-prof框架

1 框架介绍

内核态,采样事件经过filter过滤之后,存放到ringbuffer上,并递增counter计数器。只有经过filter过滤出来的事件才会放到ringbuffer。

  • 过滤器filter包含ebpf过滤器、pmu过滤器、ftrace过滤器(tracepoint),过滤可以减少事件量,筛选出感兴趣的事件。
  • 每个perf_event都有独立的ringbuffer,多个perf_event可以共用ringbuffer。ringbuffer上存放采样事件,包含一些基础数据,cpu、time、callchain等。采样默认关闭,通过perf_event_attr.sample_period参数开启采样。
  • 每个perf_event都有独立counter,不能共享。counter默认开启,不能关闭。计数和采样可以同时开启。

用户态,perf-prof框架不断读取ringbuffer的采样事件和counter,经过order排序事件,最后送到profiler处理事件。

  • order,按时间顺序排序事件,单个perf_event的ringbuffer上的事件是有序的,多个perf_event的ringbuffer不能保证顺序,需要排序合并起来。简化profiler的处理。order是可选项。

profiler,处理事件。决定打开哪些事件,如何处理事件。

  • profiler.init 初始化perf_event_attr打开对应的evsel,添加到evlist上,最终由libperf库调用perf_event_open系统调用打开perf_event。perf_event_attr.exclude_相关属性,用来配置pmu过滤器。
  • profiler.filter设置ebpf过滤器、ftrace过滤器。最终由libperf库通过ioctl设置到内核。
  • profiler.sample不断处理采样事件,完成分析工作。

2 Example: signal

一个最简单demo例子。

static profiler monitor_signal = {
    .name = "signal",
    .pages = 2,
    .init = signal_init,
    .filter = signal_filter,
    .deinit = signal_exit,
    .sample = signal_sample,
};
PROFILER_REGISTER(monitor_signal)

定义模块初始化、过滤、销毁、处理采样等接口。

3 profiler.init

static int signal_init(struct perf_evlist *evlist, struct env *env)
{
    struct perf_event_attr attr = {
        .type          = PERF_TYPE_TRACEPOINT,
        .config        = 0,
        .size          = sizeof(struct perf_event_attr),
        .sample_period = 1,
        .sample_type   = PERF_SAMPLE_TID | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU | PERF_SAMPLE_RAW |
                         (env->callchain ? PERF_SAMPLE_CALLCHAIN : 0),
        .read_format   = 0,
        .pinned        = 1,
        .disabled      = 1,
        .exclude_callchain_user = 1,
        .wakeup_events = 1, //1个事件
    };
    struct perf_evsel *evsel;
    int id;

    if (monitor_ctx_init(env) < 0)
        return -1;

    id = tep__event_id("signal", "signal_generate");
    if (id < 0)
        return -1;

    attr.config = id;
    evsel = perf_evsel__new(&attr);
    if (!evsel) {
        return -1;
    }
    perf_evlist__add(evlist, evsel);
    return 0;
}

定义perf_event_attr表示监控的事件。

tep__event_id("signal", "signal_generate"),获取signal:signal_generate tracepoint点的id。

perf_evsel__new(&attr),根据perf事件,创建evsel。1个evsel表示一个特点的事件,拿着这个事件可以到对应的cpu、线程上创建出perf_event。

perf_evlist__add(evlist, evsel),加到evlist。一个evlist表示一组evsel事件。

3.1 perf_event_attr

定义event的属性。可以指定perf命令定义的所有事件。

  • 硬件pmu事件
    • breakpoint事件
    • cpu事件
    • uncore事件
  • tracepoint点事件
  • kprobe事件
  • uprobe事件

可以通过ls /sys/bus/event_source/devices命令看到所有的事件类型。

  • perf_event_attr.type 事件类型

    PERF_TYPE_*
    	通过`cat /sys/bus/event_source/devices/*/type`获取类型。
  • perf_event_attr.config 事件配置

    根据不同的type, config值不一样。
    	PERF_TYPE_TRACEPOINT: config 指定tracepoint点的id.
    	PERF_TYPE_HARDWARE: config 指定特定的参数PERF_COUNT_HW_*
  • perf_event_attr.sample_period 采样周期

    定义采样周期, 发生多少次事件之后, 发起1个event到ring buffer
  • perf_event_attr.sample_type 采样类型

    PERF_SAMPLE_*
    	定义放到ring buffer的事件, 需要哪些字段
  • perf_event_attr.comm

    PERF_RECORD_COMM
    	记录进程comm和pid/tid的对应关系, 可以用于libtraceevent模块中tep_register_comm,
    	之后tep_print_event(ctx.tep, &s, &record, "%s", TEP_PRINT_COMM)就能打印出进程名
    	这样只能收集新创建进程的名字, 已启动进程的pid使用/proc/pid/comm来获取.
  • perf_event_attr.task

    PERF_RECORD_FORK/PERF_RECORD_EXIT
    	记录进程创建和退出事件
  • perf_event_attr.context_switch

    PERF_RECORD_SWITCH/PERF_RECORD_SWITCH_CPU_WIDE
    	记录进程切换信息

4 profiler.sample

static void signal_sample(union perf_event *event)
{
    // in linux/perf_event.h
    // PERF_SAMPLE_TID | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU | PERF_SAMPLE_RAW
    struct sample_type_data {
        struct {
            __u32    pid;
            __u32    tid;
        }    tid_entry;
        __u64   time;
        struct {
            __u32    cpu;
            __u32    reserved;
        }    cpu_entry;
        struct {
            __u32   size;
	        __u8    data[0];
        } raw;
    } *data = (void *)event->sample.array;

    tep__update_comm(NULL, data->tid_entry.tid);
    print_time(stdout);
    tep__print_event(data->time/1000, data->cpu_entry.cpu, data->raw.data, data->raw.size);
}

根据perf_event_attr.sample_type来定义采样的事件的字段,可以还原出一个结构体。

tep__print_event,打印tracepoint事件。

5 基础功能

5.1 模块化

每个profiler都是独立的模块文件,可扩展,可裁减,损耗低。适合高性能监控场景。

5.2 栈

  • 栈及符号打印。可控制内核态、用户态、地址、符号、偏移量、dso、正向栈、反向栈,每个栈帧的分隔符、栈的分隔符。
  • 支持解析内核符号(/proc/kallsyms),用户态符号(.symtab/.dynsym)、MiniDebugInfo解析(.gnu_debugdata)。
  • 支持debuginfo包。/usr/lib/debug/.build-id/
  • key-value栈。以栈做为key,可以过滤重复栈,并能唯一寻址value。
  • 生成火焰图折叠栈格式。

5.3 用户态符号表

用户态符号表,使用syms_cache结构表示,通过pid找到特定于进程的syms符号集合。

syms符号集合由/proc/pid/maps内所有的文件映射组成,每一个文件映射由一个dso来表示,syms包含dso的集合。

每个dso由映射到进程地址空间内的[起始地址、结束地址、文件对象]表示。文件对象由object结构表示。

object结构表示一个动态库的符号集合,由多个sym组成。object是可以给多个进程共享的,通过引用计数管理object的引用和释放。

sym表示一个特定的符号。由符号名字,起始地址,大小组成。

syms_cache --> syms --> dso --> object --> sym

5.4 用户态内存泄露检测

LD_PRELOAD=/lib64/libtcmalloc.so HEAPCHECK=draconian PPROF_PATH=./perf-prof /path/to/bin

利用tcmalloc的内存泄露检测功能。

  • LD_PRELOAD=,预先加载tcmalloc库,替换glibc库的malloc和free函数。
  • HEAPCHECK=,内存泄露检测。draconian检测所有的内存泄露。
  • PPROF_PATH=,指定符号解析命令。perf-prof --symbols具备跟pprof --symbols一样的符号解析能力。

5.5 栈的处理

栈的处理方式各种各样,如perf top风格的栈负载处理,火焰图风格的栈处理。

perf-prof目前支持的栈处理。

  • 栈及符号打印。用callchain_ctx表示,定义了栈的打印风格,可控制内核态、用户态、地址、符号、偏移量、dso、正向栈、反向栈。每个栈帧的分隔符、栈的分隔符。
  • key-value栈。以栈做为key,可以过滤重复栈,并能唯一寻址value。用key_value_paires结构表示,一般相同的栈都有类似的作用,如内存分配栈,可以分析相同的栈分配的总内存量,未释放的总内存量。类似于gperftools提供的HEAPCHECKE功能,最后报告的内存泄露是以栈为基准的。
  • 火焰图。把相同的栈以及栈的每一帧聚合到一起。用flame_graph结构表示,能够生成折叠栈格式:反向栈、每帧以";"分隔、末尾是栈的数量。例子:swapper;start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 1。使用flamegraph.pl生成火焰图。

5.6 火焰图

perf-prof仅输出折叠栈格式,并对输出栈比较多的模块做了支持。目前已支持:profile, task-state, kmemleak, trace

原先在stdout直接输出栈,目前切换成火焰图之后,不会再输出栈,而是会在命令结束时输出火焰图折叠栈文件。通过[-g [--flame-graph file]]参数启用火焰图,必须支持栈(-g)才能输出火焰图。折叠栈文件以file.folded命名。使用flamegraph.pl最终生成svg火焰图。

$ perf-prof task-state -S --than 100 --filter cat -g --flame-graph cat
$ flamegraph.pl cat.folded > cat.svg

5.6.1 按时间的火焰图

是以固定间隔输出折叠栈,折叠栈包含时间戳。最终生成的火焰图是按时间排序的。对于长时间的监控,可以根据时间戳查找问题。

$ grep "15:46:33" cat.folded | flamegraph.pl > cat.svg #生成15:46:33秒开始的火焰图

5.6.2 网络丢包火焰图

$ perf-prof trace -e skb:kfree_skb -g --flame-graph kfree_skb -m 128 #监控丢包
$ perf-prof trace -e skb:kfree_skb -g --flame-graph kfree_skb -i 600000 -m 128 #每600秒间隔输出火焰图
$ flamegraph.pl --reverse  kfree_skb.folded > kfree_skb.svg #生成火焰图

5.6.3 CPU性能火焰图

$ perf-prof profile -F 1000 -C 0,1 --exclude-user -g --flame-graph profile #采样内核态CPU利用率的火焰图
$ perf-prof profile -F 1000 -C 0,1 --exclude-user -g --flame-graph profile -i 600000 #每600秒间隔输出火焰图
$ grep "15:46:33" profile.folded | flamegraph.pl > profile.svg #生成15:46:33秒开始600秒的火焰图

5.7 延迟处理

perf-prof目前支持的延迟处理。

  • 统计延迟。最大延迟,最小延迟,平均延迟。
  • 直方图。log2和linear直方图,使用print_log2_histprint_linear_hist函数打印。
  • 热图。横坐标是时间轴,纵坐标是延迟信息。目前支持:kvm-exit, multi-trace

5.8 热图

$ perf-prof multi-trace -e kvm:kvm_exit -e kvm:kvm_entry -C 1 --heatmap mpdelay
$ trace2heatmap.pl --unitstime=ns --unitslabel=ns --grid mpdelay-kvm_exit-kvm_entry.lat > mpdelay-kvm_exit-kvm_entry.svg

5.9 filter

目前支持3类过滤器:ebpf过滤器、pmu过滤器、ftrace过滤器。

通过perf-prof -h可以看到过滤器的选项:

Event selector. use 'perf list tracepoint' to list available tp events.
  EVENT,EVENT,...
  EVENT: sys:name[/filter/ATTR/ATTR/.../]
  filter: ftrace filter
  ATTR:
      ...
FILTER OPTION:
      --exclude-guest        exclude guest
      --exclude-kernel       exclude kernel
      --exclude-user         exclude user
      --exclude_pid=PID      ebpf, exclude pid
  -G, --exclude-host         Monitor GUEST, exclude host
      --irqs_disabled[=0|1]  ebpf, irqs disabled or not.
      --nr_running_max=N     ebpf, maximum number of running processes for CPU runqueue.
      --nr_running_min=N     ebpf, minimum number of running processes for CPU runqueue.
      --tif_need_resched[=0|1]   ebpf, TIF_NEED_RESCHED is set or not.

其中ebpf开头的是ebpf过滤器,其他的是pmu过滤器。ftrace过滤器,只能用于tracepoint事件。

5.9.1 ebpf过滤器

内核perf_event可以通过ioctl(PERF_EVENT_IOC_SET_BPF)来设置bpf程序。bpf程序返回1,可以继续采样;bpf程序返回0,终止采样。可以依据这样的策略,来给每个perf_event增加一个过滤器。过滤不需要的采样点。

当前支持4个ebpf过滤器。

  • --irqs_disabled,判断中断是否关闭。--irqs_disabled, --irqs_disabled=1中断关闭继续采样,中断打开终止采样。--irqs_disabled=0中断打开继续采样,中断关闭终止采样。
  • --tif_need_resched,判断TIF_NEED_RESCHED标记是否设置。--tif_need_resched, --tif_need_resched=1标记设置继续采样,标记未设置终止采样。--tif_need_resched=0标记未设置继续采样,标记设置终止采样。
  • --nr_running_min,--nr_running_max,判断runqueue中nr_running进程的数量。nr_running_min <= nr_running <= nr_running_max条件满足继续采样,否则终止采样。
  • --exclude_pid,过滤掉进程pid。当前进程等于PID终止采样,否则继续采样。

5.9.2 pmu过滤器

内核perf框架默认会带一些简单的过滤器,主要是基于perf_event_attr属性来设置。

当前支持4个pmu过滤器。

  • --exclude-guest,过滤掉guest模式。
  • --exclude-host,过滤掉host,只采样guest。一般用于硬件PMU。
  • --exclude-kernel,过滤掉内核态。
  • --exclude-user,过滤掉用户态。

5.9.3 ftrace过滤器

每个tracepoint事件都可以设置ftrace过滤器。

$ perf-prof trace -e 'sched:sched_stat_runtime help

perf-prof trace -e "sched:sched_stat_runtime/./[stack/]" [-g] [--flame-graph .] [-C .] [-p .] [-i .] [--order] [--order-mem .] [-m .] 

sched:sched_stat_runtime
name: sched_stat_runtime
ID: 237
format:
        field:unsigned short common_type;       offset:0;       size:2; signed:0;
        field:unsigned char common_flags;       offset:2;       size:1; signed:0;
        field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
        field:int common_pid;   offset:4;       size:4; signed:1;

        field:char comm[16];    offset:8;       size:16;        signed:1;
        field:pid_t pid;        offset:24;      size:4; signed:1;
        field:u64 runtime;      offset:32;      size:8; signed:0;
        field:u64 vruntime;     offset:40;      size:8; signed:0;

print fmt: "comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", REC->comm, REC->pid, (unsigned long long)REC->runtime, (unsigned long long)REC->vruntime

通过在命令末尾加上help可以查看详细的帮助信息,其中包含tracepoint点的格式,可以找到可以作为过滤器的参数。

perf-prof trace -e 'sched:sched_stat_runtime/runtime>1000000/'

过滤出runtime>1000000的数据,放到ringbuffer,再由profiler进一步处理。

5.10 Attach to

perf-prof 使用一些公共参数来控制perf_event附加到CPU、线程、cgroup上。

Usage: perf-prof [OPTION...] profiler [PROFILER OPTION...] [help] [cmd [args...]]
 OPTION:
      --cgroups=cgroup,...   Attach to cgroups, support regular expression.
  -C, --cpu=CPU[-CPU],...    Monitor the specified CPU, Dflt: all cpu
  -p, --pids=PID,...         Attach to processes
  -t, --tids=TID,...         Attach to threads

可以使用逗号分隔多个CPU、PID、TID、cgroup。

5.10.1 Attach to CPU

附加到CPU,只能监控指定的CPU上发生的事件。

perf-prof trace -e sched:sched_stat_runtime -C 0-1,3

5.10.2 Attach to PID/TID

附加到PID/TID,只能监控指定的线程上发生的事件。

perf-prof trace -e sched:sched_stat_runtime -p 205835,205982

perf-prof trace -e sched:sched_stat_runtime -t 205835,205982

附加到PID,会读取该pid下的所有线程,转换成附加到TID。

5.10.3 Attach to workload

附加到workload,监控workload执行过程中的事件。

会通过fork、execvp来执行workload,并得到workload的pid。转换成附加到PID。

perf-prof task-state ip link show eth0

可以使用--强制分隔perf-prof的参数和workload的参数。

5.10.4 Attach to cgroups

附加到cgroups,监控cgroup内所有进程发生的事件。如果附加的PID太多,可以把这些PID放到perf_event cgroup内,附加到该cgroup,就能够监控到所有这些进程的事件。

# Example 1:
mkdir /sys/fs/cgroup/perf_event/prof
echo 205835 > /sys/fs/cgroup/perf_event/prof/tasks
cat /proc/205835/cgroup | grep perf_event
  5:perf_event:/prof
perf-prof trace -e sched:sched_stat_runtime --cgroups 'prof' # prof
perf-prof trace -e sched:sched_stat_runtime --cgroups 'pro*' # 正则表达式

# Example 2:
mkdir /sys/fs/cgroup/perf_event/prof1
echo 205845 > /sys/fs/cgroup/perf_event/prof/tasks
perf-prof trace -e sched:sched_stat_runtime --cgroups 'prof,prof1'
perf-prof trace -e sched:sched_stat_runtime --cgroups 'prof*' # prof, prof1

perf_event cgroup 需要手动把需要观察的进程放进去。

cgroup的指定相对于/sys/fs/cgroup/perf_event/目录,同时可以使用正则表达式,匹配多个perf_event cgroup。

5.11 USDT

usdt是用户态进程静态导出的trace点,编译之后存放在.note.stapsdtsection中。解析该section,创建出uprobe就可以trace用户态执行。

目前提供3个功能:

  • list,列出elf文件中的usdt。
  • add,利用usdt添加uprobe点,通过profider:name方式来使用。
  • del,删除已添加的uprobe点。
# Example:
perf-prof usdt add libc:memory_malloc_retry@/usr/lib64/libc.so.6 -v
perf-prof trace -e libc:memory_malloc_retry

当前已支持x86和arm64平台。

Exploring USDT Probes on Linux

Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {description} Copyright (C) {year} {fullname} This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

简介

Kernel profiler based on perf_event and ebpf 展开 收起
GPL-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/OpenCloudOS/perf-prof.git
git@gitee.com:OpenCloudOS/perf-prof.git
OpenCloudOS
perf-prof
perf-prof
main

搜索帮助