/* Copyright (c) 2013-2015 PLUMgrid, http://plumgrid.com * Copyright (c) 2015 BMW Car IT GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include #include #include #include #include #include "libbpf.h" #include "bpf_load.h" #define MAX_ENTRIES 20 #define MAX_CPU 4 #define MAX_STARS 40 struct cpu_hist { long data[MAX_ENTRIES]; long max; }; static struct cpu_hist cpu_hist[MAX_CPU]; static void stars(char *str, long val, long max, int width) { int i; for (i = 0; i < (width * val / max) - 1 && i < width - 1; i++) str[i] = '*'; if (val > max) str[i - 1] = '+'; str[i] = '\0'; } static void print_hist(void) { char starstr[MAX_STARS]; struct cpu_hist *hist; int i, j; /* clear screen */ printf("\033[2J"); for (j = 0; j < MAX_CPU; j++) { hist = &cpu_hist[j]; /* ignore CPUs without data (maybe offline?) */ if (hist->max == 0) continue; printf("CPU %d\n", j); printf(" latency : count distribution\n"); for (i = 1; i <= MAX_ENTRIES; i++) { stars(starstr, hist->data[i - 1], hist->max, MAX_STARS); printf("%8ld -> %-8ld : %-8ld |%-*s|\n", (1l << i) >> 1, (1l << i) - 1, hist->data[i - 1], MAX_STARS, starstr); } } } static void get_data(int fd) { long key, value; int c, i; for (i = 0; i < MAX_CPU; i++) cpu_hist[i].max = 0; for (c = 0; c < MAX_CPU; c++) { for (i = 0; i < MAX_ENTRIES; i++) { key = c * MAX_ENTRIES + i; bpf_map_lookup_elem(fd, &key, &value); cpu_hist[c].data[i] = value; if (value > cpu_hist[c].max) cpu_hist[c].max = value; } } } int main(int argc, char **argv) { char filename[256]; snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); if (load_bpf_file(filename)) { printf("%s", bpf_log_buf); return 1; } while (1) { get_data(map_fd[1]); print_hist(); sleep(5); } return 0; } /cgit.cgi/linux/net-next.git/diff/include/soc/fsl/qe/qe_tdm.h?id=65390ea01ce678379da32b01f39fcfac4903f256'>diff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-15 08:38:35 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-15 08:38:35 -0200
commit65390ea01ce678379da32b01f39fcfac4903f256 (patch)
tree7f849d66121533c331cf61136b124218d87cbf86 /include/soc/fsl/qe/qe_tdm.h
parente7aa8c2eb11ba69b1b69099c3c7bd6be3087b0ba (diff)
parentd183e4efcae8d88a2f252e546978658ca6d273cc (diff)
Merge branch 'patchwork' into v4l_for_linus
* patchwork: (496 commits) [media] v4l: tvp5150: Add missing break in set control handler [media] v4l: tvp5150: Don't inline the tvp5150_selmux() function [media] v4l: tvp5150: Compile tvp5150_link_setup out if !CONFIG_MEDIA_CONTROLLER [media] em28xx: don't store usb_device at struct em28xx [media] em28xx: use usb_interface for dev_foo() calls [media] em28xx: don't change the device's name [media] mn88472: fix chip id check on probe [media] mn88473: fix chip id check on probe [media] lirc: fix error paths in lirc_cdev_add() [media] s5p-mfc: Add support for MFC v8 available in Exynos 5433 SoCs [media] s5p-mfc: Rework clock handling [media] s5p-mfc: Don't keep clock prepared all the time [media] s5p-mfc: Kill all IS_ERR_OR_NULL in clocks management code [media] s5p-mfc: Remove dead conditional code [media] s5p-mfc: Ensure that clock is disabled before turning power off [media] s5p-mfc: Remove special clock rate management [media] s5p-mfc: Use printk_ratelimited for reporting ioctl errors [media] s5p-mfc: Set DMA_ATTR_ALLOC_SINGLE_PAGES [media] vivid: Set color_enc on HSV formats [media] v4l2-tpg: Init hv_enc field with a valid value ...
Diffstat (limited to 'include/soc/fsl/qe/qe_tdm.h')