Hello community, here is the log from the commit of package health-check for openSUSE:Factory checked in at 2018-07-12 09:19:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/health-check (Old) and /work/SRC/openSUSE:Factory/.health-check.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "health-check" Thu Jul 12 09:19:40 2018 rev:5 rq:622037 version:0.03.00 Changes: -------- --- /work/SRC/openSUSE:Factory/health-check/health-check.changes 2018-01-09 14:53:54.485791325 +0100 +++ /work/SRC/openSUSE:Factory/.health-check.new/health-check.changes 2018-07-12 09:21:32.162617506 +0200 @@ -1,0 +2,11 @@ +Sun Jun 17 15:05:21 UTC 2018 - [email protected] + +- Update to version 0.03.00 + * Makefile: bump version to 3.0 + * debian/copyright: use secure URI + * debian/compat: update to 11 + * debian/control: set debhelper version to >=11 + * debian/control: remove empty last line + * remove event metrics since newer kernels don't support this API + +------------------------------------------------------------------- Old: ---- health-check-0.02.09.tar.gz New: ---- health-check-0.03.00.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ health-check.spec ++++++ --- /var/tmp/diff_new_pack.BIW2Yg/_old 2018-07-12 09:21:32.654618195 +0200 +++ /var/tmp/diff_new_pack.BIW2Yg/_new 2018-07-12 09:21:32.658618201 +0200 @@ -18,16 +18,15 @@ Name: health-check -Version: 0.02.09 +Version: 0.03.00 Release: 0 Summary: Process monitoring tool -License: GPL-2.0+ +License: GPL-2.0-or-later Group: System/Monitoring -Url: http://kernel.ubuntu.com/~cking/health-check +URL: http://kernel.ubuntu.com/~cking/health-check Source: http://kernel.ubuntu.com/~cking/tarballs/%{name}/%{name}-%{version}.tar.gz -BuildRequires: pkg-config +BuildRequires: pkgconfig BuildRequires: pkgconfig(json-c) -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Health-check monitors processes and optionally their child @@ -47,9 +46,8 @@ %make_install %files -%defattr(-,root,root) -%doc COPYING +%license COPYING %{_bindir}/health-check -%{_mandir}/man8/health-check.8%{ext_man} +%{_mandir}/man8/health-check.8%{?ext_man} %changelog ++++++ health-check-0.02.09.tar.gz -> health-check-0.03.00.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/health-check-0.02.09/Makefile new/health-check-0.03.00/Makefile --- old/health-check-0.02.09/Makefile 2018-01-05 11:50:13.000000000 +0100 +++ new/health-check-0.03.00/Makefile 2018-06-16 20:55:48.000000000 +0200 @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.02.09 +VERSION=0.03.00 # # Codename "Where have all my cycles gone?" # @@ -47,7 +47,7 @@ MANDIR=/usr/share/man/man8 OBJS = list.o pid.o proc.o net.o syscall.o timeval.o \ - fnotify.o event.o cpustat.o mem.o ctxt-switch.o health-check.o + fnotify.o cpustat.o mem.o ctxt-switch.o health-check.o ifeq ($(JSON_OUTPUT),y) OBJS += json.o endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/health-check-0.02.09/event.c new/health-check-0.03.00/event.c --- old/health-check-0.02.09/event.c 2018-01-05 11:50:13.000000000 +0100 +++ new/health-check-0.03.00/event.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,385 +0,0 @@ -/* - * Copyright (C) 2013-2018 Canonical, Ltd. - * - * 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. - * - * Author: Colin Ian King <[email protected]> - */ -#define _GNU_SOURCE - -#include <stdlib.h> -#include <stdio.h> -#include <stdint.h> -#include <inttypes.h> -#include <string.h> -#include <unistd.h> - -#include "list.h" -#include "json.h" -#include "event.h" -#include "health-check.h" - -static list_t event_info_start, event_info_finish; -static bool timer_stats = true; - -/* - * event_timer_stat_set() - * enable/disable timer stat - */ -static int event_timer_stat_set(const char *str) -{ - FILE *fp; - - if ((fp = fopen(TIMER_STATS, "w")) == NULL) - return -1; - fprintf(fp, "%s\n", str); - (void)fclose(fp); - - return 0; -} - -/* - * event_free() - * free event info - */ -static void event_free(void *data) -{ - event_info_t *ev = (event_info_t *)data; - - free(ev->func); - free(ev->callback); - free(ev->ident); - free(ev); -} - -/* - * event_cmp() - * compare event info for sorting - */ -static int event_cmp(const void *data1, const void *data2) -{ - const event_info_t *ev1 = (const event_info_t *)data1; - const event_info_t *ev2 = (const event_info_t *)data2; - - return ev2->count - ev1->count; -} - -/* - * event_add() - * add event stats - */ -static int event_add( - list_t *events, /* event list */ - const uint64_t count, /* event count */ - const pid_t pid, /* PID of task */ - const char *func, /* Kernel function */ - const char *callback) /* Kernel timer callback */ -{ - char ident[4096]; - event_info_t *ev; - link_t *l; - proc_info_t *p; - - /* Does it exist? */ - if ((p = proc_cache_find_by_pid(pid)) == NULL) - return 0; - - snprintf(ident, sizeof(ident), "%d:%s:%s:%s", pid, p->comm, func, callback); - - for (l = events->head; l; l = l->next) { - ev = (event_info_t *)l->data; - if (strcmp(ev->ident, ident) == 0) { - ev->count += count; - return 0; - } - } - - /* Not found, it is new! */ - - if ((ev = calloc(1, sizeof(event_info_t))) == NULL) { - health_check_out_of_memory("allocting event information"); - return -1; - } - - ev->proc = p; - ev->func = strdup(func); - ev->callback = strdup(callback); - ev->ident = strdup(ident); - ev->count = count; - - if (ev->func == NULL || ev->callback == NULL || ev->ident == NULL) { - health_check_out_of_memory("allocting event information"); - goto err; - } - - if (list_add_ordered(events, ev, event_cmp) == NULL) - goto err; - - return 0; -err: - free(ev->func); - free(ev->callback); - free(ev->ident); - free(ev); - - return -1; -} - -/* - * event_get_all_pids() - * scan /proc/timer_stats and populate a timer stat hash table with - * unique events - */ -int event_get_all_pids(const list_t *pids, proc_state state) -{ - FILE *fp; - char buf[4096]; - list_t *events = (state == PROC_START) ? &event_info_start : &event_info_finish; - - if ((fp = fopen(TIMER_STATS, "r")) == NULL) { - fprintf(stderr, "Cannot open %s.\n", TIMER_STATS); - return 0; - } - - while (!feof(fp)) { - char *ptr = buf; - uint64_t count = 0; - pid_t event_pid = -1; - char func[128]; - char timer[128]; - link_t *l; - - if (fgets(buf, sizeof(buf), fp) == NULL) - break; - - if (strstr(buf, "total events") != NULL) - break; - - if (strstr(buf, ",") == NULL) - continue; - - /* format: count[D], pid, comm, func (timer) */ - - while (*ptr && *ptr != ',') - ptr++; - - if (*ptr != ',') - continue; - - if (ptr > buf && *(ptr-1) == 'D') - continue; /* Deferred event, skip */ - - ptr++; - sscanf(buf, "%" SCNu64, &count); - sscanf(ptr, "%8d", &event_pid); - sscanf(ptr + 24, "%127s (%127[^)])", func, timer); - - for (l = pids->head; l; l = l->next) { - proc_info_t *p = (proc_info_t *)l->data; - if (event_pid == p->pid) { - if (event_add(events, count, event_pid, func, timer) < 0) { - (void)fclose(fp); - return -1; - } - break; - } - } - } - - (void)fclose(fp); - - return 0; -} - -/* - * event_loading() - * - */ -static const char *event_loading(const double wakeup_rate) -{ - if (FLOAT_CMP(wakeup_rate, 0.0)) - return "idle"; - if (wakeup_rate > 200.0) - return "very excessive"; - if (wakeup_rate > 60.0) - return "excessive"; - if (wakeup_rate > 20.0) - return "very high"; - if (wakeup_rate > 10.0) - return "high"; - if (wakeup_rate > 5.0) - return "quite high"; - if (wakeup_rate > 1.0) - return "moderate"; - if (wakeup_rate > 0.25) - return "low"; - return "very low"; -} - -/* - * event_delta() - * find delta in events between old, new. - * if no old then delta is the new. - */ -static uint64_t event_delta(const event_info_t *event_new, const list_t *events_old) -{ - link_t *l; - - for (l = events_old->head; l; l = l->next) { - event_info_t *event_old = (event_info_t*)l->data; - if (strcmp(event_new->ident, event_old->ident) == 0) - return event_new->count - event_old->count; - } - return event_new->count; -} - - -/* - * event_dump_diff() - * dump differences between old and new events - */ -void event_dump_diff( - json_object *j_tests, - const double duration) -{ - link_t *l; -#ifndef JSON_OUTPUT - (void)j_tests; -#endif - - printf("Wakeups:\n"); - - if (event_info_finish.head) { - if (opt_flags & OPT_BRIEF) { - double event_rate = 0.0; - for (l = event_info_finish.head; l; l = l->next) { - event_info_t *event_new = (event_info_t *)l->data; - uint64_t delta = event_delta(event_new, &event_info_start); - event_rate += (double)delta; - } - event_rate /= duration; - printf(" %.2f wakeups/sec (%s)\n\n", - event_rate, event_loading(event_rate)); - } else { - int count = 0; - double total = 0.0; - const int pid_size = pid_max_digits(); - - printf(" %*s Process Wake/Sec Kernel Functions\n", - pid_size, "PID"); - for (l = event_info_finish.head; l; l = l->next) { - event_info_t *event_new = (event_info_t *)l->data; - uint64_t delta = event_delta(event_new, &event_info_start); - double event_rate = (double)delta / duration; - - printf(" %*d %-20.20s %9.2f (%s, %s) (%s)\n", - pid_size, event_new->proc->pid, - event_new->proc->cmdline, - event_rate, - event_new->func, event_new->callback, - event_loading(event_rate)); - total += event_rate; - count++; - } - if (count > 1) - printf(" %-27.27s%9.2f\n", "Total", - total); - printf("\n"); - } - } else { - printf(" No wakeups detected%s.\n\n", - timer_stats ? "" : " (Access to " TIMER_STATS " failed)"); - } - -#ifdef JSON_OUTPUT - if (j_tests) { - json_object *j_event_test, *j_events, *j_event; - uint64_t total_delta = 0; - double total_event_rate; - - if ((j_event_test = j_obj_new_obj()) == NULL) - goto out; - j_obj_obj_add(j_tests, "wakeup-events", j_event_test); - if ((j_events = j_obj_new_array()) == NULL) - goto out; - j_obj_obj_add(j_event_test, "wakeup-events-per-process", j_events); - - for (l = event_info_finish.head; l; l = l->next) { - event_info_t *event = (event_info_t *)l->data; - uint64_t delta = event_delta(event, &event_info_start); - double event_rate = (double)delta / duration; - total_delta += delta; - - /* We may as well dump everything */ - if ((j_event = j_obj_new_obj()) == NULL) - goto out; - j_obj_new_int32_add(j_event, "pid", event->proc->pid); - j_obj_new_int32_add(j_event, "ppid", event->proc->ppid); - j_obj_new_int32_add(j_event, "is-thread", event->proc->is_thread); - j_obj_new_string_add(j_event, "name", event->proc->cmdline); - j_obj_new_string_add(j_event, "kernel-timer-func", event->func); - j_obj_new_string_add(j_event, "kernel-timer-callback", event->callback); - j_obj_new_int64_add(j_event, "wakeups", delta); - j_obj_new_double_add(j_event, "wakeup-rate", event_rate); - j_obj_new_string_add(j_event, "load-hint", event_loading(event_rate)); - j_obj_array_add(j_events, j_event); - } - - total_event_rate = (double)total_delta / duration; - if ((j_event = j_obj_new_obj()) == NULL) - goto out; - j_obj_obj_add(j_event_test, "wakeup-events-total", j_event); - j_obj_new_int64_add(j_event, "wakeup-total", total_delta); - j_obj_new_double_add(j_event, "wakeup-total-rate", total_event_rate); - j_obj_new_string_add(j_event, "load-hint-total", event_loading(total_event_rate)); - } -out: -#endif - return; -} - -/* - * event_init() - * initialise events and start timer stat - */ -void event_init(void) -{ - list_init(&event_info_start); - list_init(&event_info_finish); - - /* Should really catch signals and set back to zero before we die */ - if (event_timer_stat_set("1") < 0) - timer_stats = false; -} - -/* - * event_stop() - * stop event timer stat - */ -void event_stop(void) -{ - if (timer_stats) - event_timer_stat_set("0"); -} - -/* - * event_cleanup() - * free memory - */ -void event_cleanup(void) -{ - list_free(&event_info_start, event_free); - list_free(&event_info_finish, event_free); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/health-check-0.02.09/health-check.c new/health-check-0.03.00/health-check.c --- old/health-check-0.02.09/health-check.c 2018-01-05 11:50:13.000000000 +0100 +++ new/health-check-0.03.00/health-check.c 2018-06-16 20:55:48.000000000 +0200 @@ -114,7 +114,6 @@ */ void health_check_exit(const int status) { - event_stop(); exit(status); } @@ -576,9 +575,6 @@ syscall_trace_proc(&pids); #endif mem_init(); -#if EVENT_SUPPORTED - event_init(); -#endif cpustat_init(); ctxt_switch_init(); @@ -588,10 +584,6 @@ gettimeofday(&tv_start, NULL); tv_end = timeval_add(&tv_start, &duration); -#if EVENT_SUPPORTED - if (event_get_all_pids(&pids, PROC_START) < 0) - goto out; -#endif if (cpustat_get_all_pids(&pids, PROC_START) < 0) goto out; if (mem_get_all_pids(&pids, PROC_START) < 0) @@ -655,19 +647,12 @@ duration = timeval_sub(&tv_now, &tv_start); actual_duration = timeval_to_double(&duration); -#if EVENT_SUPPORTED - if (event_get_all_pids(&pids, PROC_FINISH) < 0) - goto out; -#endif if (cpustat_get_all_pids(&pids, PROC_FINISH) < 0) goto out; if (mem_get_all_pids(&pids, PROC_FINISH) < 0) goto out; if (ctxt_switch_get_all_pids(&pids, PROC_FINISH) < 0) goto out; -#if EVENT_SUPPORTED - event_stop(); -#endif #if SYSCALL_SUPPORTED if (syscall_stop() < 0) goto out; @@ -680,9 +665,6 @@ cpustat_dump_diff(json_tests, actual_duration); pagefault_dump_diff(json_tests, actual_duration); -#if EVENT_SUPPORTED - event_dump_diff(json_tests, actual_duration); -#endif ctxt_switch_dump_diff(json_tests, actual_duration); #if FNOTIFY_SUPPORTED fnotify_dump_events(json_tests, actual_duration, &pids); @@ -726,9 +708,6 @@ #if SYSCALL_SUPPORTED syscall_cleanup(); #endif -#if EVENT_SUPPORTED - event_cleanup(); -#endif cpustat_cleanup(); ctxt_switch_cleanup(); #if FNOTIFY_SUPPORTED
