mirror of
https://github.com/clearlinux/telemetrics-client.git
synced 2026-09-01 11:15:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54b66b2820 | ||
|
|
bccd669c91 | ||
|
|
01fd01a49a |
@@ -16,7 +16,6 @@ addons:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- libglib2.0-dev
|
||||
- libcurl4-gnutls-dev
|
||||
- valgrind
|
||||
- autoconf
|
||||
|
||||
@@ -23,8 +23,6 @@ Build dependencies
|
||||
|
||||
- libcurl
|
||||
|
||||
- glib
|
||||
|
||||
- elfutils, which provides libelf and libdwfl libraries..
|
||||
|
||||
- (optional) libsystemd, for syslog-style logging to the systemd journal, and
|
||||
|
||||
+1
-2
@@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([telemetrics-client], [1.12.1], [https://clearlinux.org/])
|
||||
AC_INIT([telemetrics-client], [1.12.2], [https://clearlinux.org/])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AM_INIT_AUTOMAKE([1.14 -Wall -Werror -Wno-extra-portability foreign subdir-objects])
|
||||
AM_SILENT_RULES([yes])
|
||||
@@ -25,7 +25,6 @@ AC_PROG_MAKE_SET
|
||||
# check >= 0.9.12 is required for TAP output
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.12])
|
||||
PKG_CHECK_MODULES([CURL], [libcurl])
|
||||
PKG_CHECK_MODULES([GLIB], [glib-2.0])
|
||||
AC_CHECK_LIB([elf], [elf_begin], [have_elflib=yes], [AC_MSG_ERROR([Unable to find libelf from elfutils])])
|
||||
AC_CHECK_LIB([dw], [dwfl_begin], [have_dwlib=yes], [AC_MSG_ERROR([Unable to find libdw from elfutils])])
|
||||
AS_IF([test "x$have_elflib" = "xyes" -a "x$have_dwlib" = "xyes"],
|
||||
|
||||
+2
-8
@@ -51,15 +51,11 @@ noinst_LTLIBRARIES = %D%/libtelem-shared.la
|
||||
%D%/common.h
|
||||
|
||||
%C%_libtelem_shared_la_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
|
||||
%C%_libtelem_shared_la_LDFLAGS = \
|
||||
$(AM_LDFLAGS)
|
||||
|
||||
%C%_libtelem_shared_la_LIBADD = \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
%D%/libtelemetry.la
|
||||
|
||||
@@ -71,12 +67,10 @@ include_HEADERS = %D%/telemetry.h
|
||||
noinst_HEADERS = %D%/log.h
|
||||
|
||||
%C%_libtelemetry_la_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
|
||||
%C%_libtelemetry_la_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
$(GLIB_LIBS) \
|
||||
-version-info $(SHAREDLIB_CURRENT):$(SHAREDLIB_REVISION):$(SHAREDLIB_AGE) \
|
||||
-Wl,--version-script=$(top_srcdir)/src/telemetry.sym
|
||||
|
||||
|
||||
+10
-22
@@ -15,10 +15,8 @@ bin_PROGRAMS += \
|
||||
|
||||
%C%_telem_record_gen_SOURCES = %D%/telem_record_gen.c
|
||||
%C%_telem_record_gen_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
%C%_telem_record_gen_LDADD = $(top_builddir)/src/libtelemetry.la \
|
||||
$(GLIB_LIBS)
|
||||
$(AM_CFLAGS)
|
||||
%C%_telem_record_gen_LDADD = $(top_builddir)/src/libtelemetry.la
|
||||
%C%_telem_record_gen_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
-pie
|
||||
@@ -48,13 +46,11 @@ endif
|
||||
src/nica/nc-string.c \
|
||||
%D%/probe.h
|
||||
%C%_crashprobe_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
%C%_crashprobe_LDADD = \
|
||||
$(top_builddir)/src/libtelemetry.la \
|
||||
$(top_builddir)/src/libtelem-shared.la \
|
||||
@ELFUTILS_LIBS@ \
|
||||
$(GLIB_LIBS)
|
||||
@ELFUTILS_LIBS@
|
||||
%C%_crashprobe_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
-pie
|
||||
@@ -73,12 +69,10 @@ endif
|
||||
src/nica/nc-string.c \
|
||||
%D%/oops_parser.c
|
||||
%C%_pstoreprobe_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
%C%_pstoreprobe_LDADD = \
|
||||
$(top_builddir)/src/libtelemetry.la \
|
||||
$(top_builddir)/src/libtelem-shared.la \
|
||||
$(GLIB_LIBS)
|
||||
$(top_builddir)/src/libtelem-shared.la
|
||||
|
||||
if LOG_SYSTEMD
|
||||
if HAVE_SYSTEMD_JOURNAL
|
||||
@@ -97,11 +91,9 @@ endif
|
||||
src/nica/nc-string.c \
|
||||
%D%/oops_parser.c
|
||||
%C%_klogscanner_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
%C%_klogscanner_LDADD = \
|
||||
$(top_builddir)/src/libtelemetry.la \
|
||||
$(GLIB_LIBS)
|
||||
$(top_builddir)/src/libtelemetry.la
|
||||
%C%_klogscanner_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
-pie
|
||||
@@ -128,12 +120,10 @@ endif
|
||||
src/nica/nc-string.c \
|
||||
%D%/probe.h
|
||||
%C%_oopsprobe_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
$(AM_CFLAGS)
|
||||
%C%_oopsprobe_LDADD = \
|
||||
$(top_builddir)/src/libtelemetry.la \
|
||||
$(top_builddir)/src/libtelem-shared.la \
|
||||
$(GLIB_LIBS)
|
||||
$(top_builddir)/src/libtelem-shared.la
|
||||
|
||||
if LOG_SYSTEMD
|
||||
if HAVE_SYSTEMD_JOURNAL
|
||||
@@ -154,13 +144,11 @@ bin_PROGRAMS += \
|
||||
%D%/journal.c
|
||||
%C%_journalprobe_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(SYSTEMD_ID128_CFLAGS) \
|
||||
$(SYSTEMD_JOURNAL_CFLAGS)
|
||||
%C%_journalprobe_LDADD = \
|
||||
$(top_builddir)/src/libtelemetry.la \
|
||||
$(top_builddir)/src/libtelem-shared.la \
|
||||
$(GLIB_LIBS) \
|
||||
$(SYSTEMD_ID128_LIBS) \
|
||||
$(SYSTEMD_JOURNAL_LIBS)
|
||||
%C%_journalprobe_LDFLAGS = \
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@@ -26,6 +25,7 @@
|
||||
#include "log.h"
|
||||
#include "telemetry.h"
|
||||
#include "oops_parser.h"
|
||||
#include "nica/hashmap.h"
|
||||
|
||||
char *pstore_dump_path = PSTOREDIR;
|
||||
|
||||
@@ -202,8 +202,8 @@ int main(int argc, char **argv)
|
||||
DIR *pstore_dir;
|
||||
struct dirent *entry;
|
||||
struct chunk_list *elem, *head;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
NcHashmapIter iter;
|
||||
void *key, *value;
|
||||
int max_part;
|
||||
size_t totalsize = 0;
|
||||
char *crash_dump = NULL;
|
||||
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
|
||||
* Hash table used to store chunks belonging to a oops counter
|
||||
* key -> count, value->head of linked list of chunks
|
||||
*/
|
||||
GHashTable *hash = g_hash_table_new(g_int_hash, g_int_equal);
|
||||
NcHashmap *hash = nc_hashmap_new(nc_simple_hash, nc_simple_compare);
|
||||
|
||||
pstore_dir = opendir(pstore_dump_path);
|
||||
if (pstore_dir == NULL) {
|
||||
@@ -250,23 +250,20 @@ int main(int argc, char **argv)
|
||||
elem->contents = read_contents(entry->d_name, &(elem->size));
|
||||
elem->next = NULL;
|
||||
|
||||
gpointer head = g_hash_table_lookup(hash, (void *)(&elem->count));
|
||||
void *head = nc_hashmap_get(hash, NC_HASH_KEY(elem->count));
|
||||
if (head != NULL) {
|
||||
elem->next = (struct chunk_list *)head;
|
||||
}
|
||||
|
||||
gint *key = g_new(gint, 1);
|
||||
*key = elem->count;
|
||||
g_hash_table_insert(hash, key, elem);
|
||||
|
||||
nc_hashmap_put(hash, NC_HASH_KEY(elem->count), elem);
|
||||
}
|
||||
|
||||
closedir(pstore_dir);
|
||||
|
||||
g_hash_table_iter_init (&iter, hash);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
nc_hashmap_iter_init(hash, &iter);
|
||||
while (nc_hashmap_iter_next(&iter, (void **)&key, (void **)&value)) {
|
||||
#ifdef DEBUG
|
||||
printf("Count in the hash: %d\n", *((int *)key));
|
||||
printf("Count in the hash: %d\n", NC_UNHASH_KEY(key));
|
||||
#endif
|
||||
|
||||
head = (struct chunk_list *)value;
|
||||
|
||||
+3
-11
@@ -24,12 +24,10 @@ dist_check_SCRIPTS = \
|
||||
|
||||
%C%_check_config_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
@CHECK_CFLAGS@ \
|
||||
@GLIB_CFLAGS@
|
||||
@CHECK_CFLAGS@
|
||||
|
||||
%C%_check_config_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@GLIB_LIBS@ \
|
||||
$(top_builddir)/src/libtelem-shared.la
|
||||
|
||||
%C%_check_daemon_SOURCES = \
|
||||
@@ -40,11 +38,9 @@ dist_check_SCRIPTS = \
|
||||
%C%_check_daemon_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
@CHECK_CFLAGS@ \
|
||||
@GLIB_CFLAGS@ \
|
||||
@CURL_CFLAGS@
|
||||
%C%_check_daemon_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@GLIB_LIBS@ \
|
||||
@CURL_LIBS@ \
|
||||
$(top_builddir)/src/libtelem-shared.la
|
||||
|
||||
@@ -96,11 +92,9 @@ EXTRA_DIST += \
|
||||
|
||||
%C%_check_probes_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
@CHECK_CFLAGS@ \
|
||||
@GLIB_CFLAGS@
|
||||
@CHECK_CFLAGS@
|
||||
%C%_check_probes_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@GLIB_LIBS@ \
|
||||
$(top_builddir)/src/libtelem-shared.la
|
||||
|
||||
if LOG_SYSTEMD
|
||||
@@ -118,11 +112,9 @@ endif
|
||||
|
||||
%C%_check_libtelemetry_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
@CHECK_CFLAGS@ \
|
||||
@GLIB_CFLAGS@
|
||||
@CHECK_CFLAGS@
|
||||
%C%_check_libtelemetry_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@GLIB_LIBS@ \
|
||||
$(top_builddir)/src/libtelemetry.la \
|
||||
$(top_builddir)/src/libtelem-shared.la
|
||||
|
||||
|
||||
Reference in New Issue
Block a user