Skip to content

Commit e86da09

Browse files
lauxinwlijinxia
authored andcommitted
tools: acrn-crashlog: main thread of acrn-crashlog/acrnprobe
This patch implements the main thread of acrnprobe. As a log collection mechanism to record critical events on the platform, acrnprobe provides the following features: 1. detect event. 2. analyze event and determine the event type. 3. collect information for the detected events. 4. archive these information as logs, and generate records. Signed-off-by: Liu Xinwu <xinwu.liu@intel.com> Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com> Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Acked-by: Eddie Dong <Eddie.dong@intel.com>
1 parent 6e656df commit e86da09

File tree

14 files changed

+268
-6
lines changed

14 files changed

+268
-6
lines changed

tools/acrn-crashlog/acrnprobe/Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
BASEDIR := $(shell pwd)
22

33
LIBS = -lpthread -lxml2 -lcrypto -lrt -lsystemd -ltelemetry
4+
INCLUDE += -I $(BASEDIR)/include
45
CFLAGS += $(INCLUDE)
56
CFLAGS += -g -O0 -std=gnu11
67
CFLAGS += -ffunction-sections -fdata-sections
@@ -14,7 +15,17 @@ all: check_dirs $(TARGET)
1415
$(BUILDDIR)/acrnprobe/obj/%.o:%.c
1516
$(CC) -c $(CFLAGS) $< -o $@
1617

17-
$(BUILDDIR)/acrnprobe/bin/acrnprobe: $(BUILDDIR)/acrnprobe/obj/main.o
18+
$(BUILDDIR)/acrnprobe/bin/acrnprobe: $(BUILDDIR)/acrnprobe/obj/main.o \
19+
$(BUILDDIR)/common/obj/log_sys.o \
20+
$(BUILDDIR)/common/obj/cmdutils.o \
21+
$(BUILDDIR)/common/obj/fsutils.o \
22+
$(BUILDDIR)/common/obj/strutils.o \
23+
$(BUILDDIR)/acrnprobe/obj/load_conf.o \
24+
$(BUILDDIR)/acrnprobe/obj/channels.o \
25+
$(BUILDDIR)/acrnprobe/obj/event_queue.o \
26+
$(BUILDDIR)/acrnprobe/obj/event_handler.o \
27+
$(BUILDDIR)/acrnprobe/obj/crash_reclassify.o \
28+
$(BUILDDIR)/acrnprobe/obj/sender.o
1829
$(CC) -o $@ $^ $(LDFLAGS)
1930

2031
clean:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#include "channels.h"
7+
8+
int init_channels(void)
9+
{
10+
return 0;
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#include "crash_reclassify.h"
7+
8+
void init_crash_reclassify(void)
9+
{
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#include "event_handler.h"
7+
8+
int init_event_handler(void)
9+
{
10+
return 0;
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#include "event_queue.h"
7+
8+
void init_event(void)
9+
{
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#ifndef _CHANNELS_H
7+
#define _CHANNELS_H
8+
9+
extern int init_channels(void);
10+
11+
#endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
extern void init_crash_reclassify(void);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
extern int init_event_handler(void);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#ifndef __EVENT_QUEUE_H__
7+
#define __EVENT_QUEUE_H__
8+
9+
void init_event_queue(void);
10+
11+
#endif
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
6+
#ifndef __LOAD_CONF_H__
7+
#define __LOAD_CONF_H__
8+
9+
#define SENDER_MAX 3
10+
11+
struct uptime_t {
12+
char *name;
13+
char *frequency;
14+
char *eventhours;
15+
16+
int wd;
17+
char *path;
18+
};
19+
20+
struct sender_t {
21+
struct uptime_t *uptime;
22+
};
23+
24+
struct conf_t {
25+
struct sender_t *sender[SENDER_MAX];
26+
};
27+
28+
struct conf_t conf;
29+
30+
#define for_each_sender(id, sender, conf) \
31+
for (id = 0, sender = conf.sender[0]; \
32+
id < SENDER_MAX; \
33+
id++, sender = conf.sender[id])
34+
35+
int load_conf(char *path);
36+
37+
#endif

0 commit comments

Comments
 (0)