drivers: Nuke kperfmon
This commit is contained in:
parent
90c03d0f0b
commit
dc32d2987c
12 changed files with 0 additions and 1308 deletions
|
@ -7147,12 +7147,6 @@ CONFIG_SB_VOTE=y
|
|||
|
||||
CONFIG_SEC_KQ_MESH=m
|
||||
|
||||
#
|
||||
# samsung Performace manager
|
||||
#
|
||||
# CONFIG_KPERFMON is not set
|
||||
# end of samsung Performace manager
|
||||
|
||||
CONFIG_VIBRATOR_VIB_INFO=m
|
||||
CONFIG_INPUT_SEC_INPUT=m
|
||||
CONFIG_SEC_DEBUG_TSP_LOG=m
|
||||
|
|
|
@ -260,7 +260,6 @@ source "drivers/sti/common/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
|||
source "drivers/input/input_boost/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/battery/core/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/kq/mesh/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/kperfmon/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/vibrator/common/vib_info/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/input/sec_input/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/usb/common/vbus_notifier/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
|
|
|
@ -216,7 +216,6 @@ obj-y += muic/common/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
|||
obj-y += input/input_boost/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += battery/core/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += kq/mesh/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += kperfmon/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += vibrator/common/vib_info/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += input/sec_input/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += usb/common/vbus_notifier/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# Samsung Performance Logging system
|
||||
#
|
||||
|
||||
menu "samsung Performace manager"
|
||||
|
||||
config KPERFMON
|
||||
bool "Enable performance log"
|
||||
default y
|
||||
help
|
||||
Samsung performance log(OLOG).
|
||||
Say Y here if enable performance olog driver to do logging system resources.
|
||||
When some delay occurs in the kernel, native or user user space,
|
||||
the logging information should be restored into the system.
|
||||
|
||||
config KPERFMON_BUILD
|
||||
tristate "Building tyoe of performance log"
|
||||
default y
|
||||
help
|
||||
Samsung performance log(OLOG).
|
||||
This is to set a build type for module or build-in.
|
||||
Say m here if you want a module of performance olog driver.
|
||||
Say y here if you want build-in object of the performance olog driver.
|
||||
|
||||
endmenu
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
#
|
||||
# Makefile for the Linux kernel device drivers.
|
||||
#
|
||||
# Sep 2018, Binse Park <h22yap@gmail.com>
|
||||
# Rewritten to use lists instead of if-statements.
|
||||
#
|
||||
|
||||
FLAG=1
|
||||
|
||||
ifneq ($(CONFIG_KPERFMON), y)
|
||||
FLAG=0
|
||||
$(info kperfmon_DUMMY="CONFIG_KPERFMON is off.")
|
||||
endif
|
||||
|
||||
ifneq ($(shell [ -e $(srctree)/include/linux/olog.pb.h ] && echo exist), exist)
|
||||
$(info kperfmon_DUMMY="olog.pb.h file is missing... retrying")
|
||||
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../../frameworks/base/proto/src/olog.proto $(srctree)/drivers/kperfmon/)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../../vendor/samsung/system/libperflog/aprotoc $(srctree)/drivers/kperfmon/)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../../system/logging/libperflog/aprotoc $(srctree)/drivers/kperfmon/)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../frameworks/base/proto/src/olog.proto $(srctree)/drivers/kperfmon/)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../vendor/samsung/system/libperflog/aprotoc $(srctree)/drivers/kperfmon/)")
|
||||
$(info kperfmon_DUMMY="$(shell chmod 777 $(srctree)/drivers/kperfmon/aprotoc)")
|
||||
$(info kperfmon_DUMMY="$(shell $(srctree)/drivers/kperfmon/aprotoc --perflog_out=$(srctree)/drivers/kperfmon/ --proto_path=$(srctree)/drivers/kperfmon/ $(srctree)/drivers/kperfmon/olog.proto)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/drivers/kperfmon/olog.pb.h $(srctree)/include/linux/)")
|
||||
#$(info kperfmon_DUMMY="$(shell ls $(srctree)/drivers/kperfmon/*)")
|
||||
#$(info kperfmon_DUMMY="$(shell ls $(srctree)/include/linux/olog*)")
|
||||
|
||||
ifneq ($(shell [ -e $(srctree)/include/linux/olog.pb.h ] && echo exist), exist)
|
||||
$(info kperfmon_DUMMY="olog.pb.h file is missing... again")
|
||||
FLAG=0
|
||||
endif
|
||||
endif
|
||||
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../../system/core/liblog/include/log/perflog.h $(srctree)/include/linux/)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../../system/logging/liblog/include/log/perflog.h $(srctree)/include/linux/)")
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/../system/core/liblog/include/log/perflog.h $(srctree)/include/linux/)")
|
||||
|
||||
ifneq ($(shell [ -e $(srctree)/drivers/kperfmon/perflog.h ] && echo exist), exist)
|
||||
FLAG=0
|
||||
$(info kperfmon_DUMMY="perflog.h file is missing.")
|
||||
endif
|
||||
|
||||
ifeq ($(FLAG), 1)
|
||||
$(info kperfmon_DUMMY="$(shell cp -f $(srctree)/drivers/kperfmon/ologk.h $(srctree)/include/linux/)")
|
||||
ifeq ($(CONFIG_KPERFMON_BUILD), y)
|
||||
obj-y += kperfmon.o
|
||||
else
|
||||
obj-m += kperfmon.o
|
||||
endif
|
||||
endif
|
|
@ -1,892 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Samsung's performance logging
|
||||
//
|
||||
// Copyright (c) 2017 Samsung Electronics Co., Ltd
|
||||
// http://www.samsung.com
|
||||
//
|
||||
// Binse Park <unsang.park@samsung.com>
|
||||
|
||||
#define KPERFMON_KERNEL
|
||||
#include <linux/ologk.h>
|
||||
#undef KPERFMON_KERNEL
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sec_debug.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
|
||||
#define KPERFMON_KERNEL
|
||||
#include "perflog.h"
|
||||
#undef KPERFMON_KERNEL
|
||||
#else
|
||||
#include "perflog.h"
|
||||
#endif
|
||||
#if !defined(KPERFMON_KMALLOC)
|
||||
#include <linux/vmalloc.h>
|
||||
#endif
|
||||
#include <linux/sched/cputime.h>
|
||||
#include <linux/sched/signal.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/stacktrace.h>
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
|
||||
#define rtc_time_to_tm(a, b) rtc_time64_to_tm(a, b)
|
||||
|
||||
struct timeval {
|
||||
time64_t tv_sec;
|
||||
long tv_usec;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#include "kperfmon.h"
|
||||
|
||||
#define PROC_NAME "kperfmon"
|
||||
#if defined(KPERFMON_KMALLOC)
|
||||
#define BUFFER_SIZE (5 * 1024)
|
||||
#else
|
||||
#define BUFFER_SIZE (5 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#define HEADER_SIZE PERFLOG_HEADER_SIZE
|
||||
#define DEBUGGER_SIZE 32
|
||||
#define STREAM_SIZE (PERFLOG_BUFF_STR_MAX_SIZE + PERFLOG_HEADER_SIZE)
|
||||
#define READ_BUFFER_SIZE (STREAM_SIZE + 100)
|
||||
|
||||
#define MAX_DEPTH_OF_CALLSTACK 20
|
||||
#define MAX_MUTEX_RAWDATA 20
|
||||
|
||||
#define SIGNAL_35 35
|
||||
#define SIGNAL_OLOG 5209
|
||||
|
||||
#if defined(USE_MONITOR)
|
||||
#define MAX_MUTEX_RAWDATA_DIGIT 2
|
||||
#define DIGIT_UNIT 100000000
|
||||
#endif
|
||||
|
||||
#define KPERFMON_VERSION_LENGTH 100
|
||||
|
||||
struct tRingBuffer buffer = {0, };
|
||||
//const struct file_operations;
|
||||
|
||||
struct t_before_print *before_list_cur_pos;
|
||||
static LIST_HEAD(before_print_list);
|
||||
|
||||
void CreateBuffer(struct tRingBuffer *buffer,
|
||||
unsigned long length)
|
||||
{
|
||||
if (buffer->data != 0)
|
||||
return;
|
||||
|
||||
#if defined(KPERFMON_KMALLOC)
|
||||
buffer->data = kmalloc(length + 1, GFP_KERNEL);
|
||||
#else
|
||||
buffer->data = vmalloc(length + 1);
|
||||
#endif
|
||||
if (buffer->data == 0) {
|
||||
pr_info("kperfmon error [%s] buffer->data is null!!!\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer->length = length;
|
||||
buffer->start = -1;
|
||||
buffer->end = 0;
|
||||
buffer->status = FLAG_NOTHING;
|
||||
buffer->debugger = 0;
|
||||
|
||||
memset(buffer->data, 0, length + 1);
|
||||
|
||||
mutex_init(&buffer->mutex);
|
||||
}
|
||||
|
||||
void DestroyBuffer(struct tRingBuffer *buffer)
|
||||
{
|
||||
if (buffer->data != 0) {
|
||||
#if defined(KPERFMON_KMALLOC)
|
||||
kfree(buffer->data);
|
||||
#else
|
||||
vfree(buffer->data);
|
||||
#endif
|
||||
buffer->data = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteBuffer(struct tRingBuffer *buffer,
|
||||
byte *data,
|
||||
unsigned long length)
|
||||
{
|
||||
long RemainSize = 0;
|
||||
|
||||
if (length < 0)
|
||||
return;
|
||||
|
||||
if (buffer->length < buffer->end + length) {
|
||||
long FirstSize = buffer->length - buffer->end;
|
||||
|
||||
WriteBuffer(buffer, data, FirstSize);
|
||||
WriteBuffer(buffer, data + FirstSize, length - FirstSize);
|
||||
return;
|
||||
}
|
||||
|
||||
RemainSize = (buffer->start < buffer->end) ?
|
||||
(buffer->length - buffer->end) :
|
||||
(buffer->start - buffer->end);
|
||||
|
||||
while (RemainSize < length) {
|
||||
int bstart = (buffer->start + HEADER_SIZE - 1);
|
||||
int cur_length = *(buffer->data + bstart % buffer->length);
|
||||
|
||||
buffer->start += HEADER_SIZE + cur_length;
|
||||
buffer->start %= buffer->length;
|
||||
|
||||
RemainSize = (buffer->start < buffer->end) ?
|
||||
(buffer->length - buffer->end) :
|
||||
(buffer->start - buffer->end);
|
||||
}
|
||||
|
||||
memcpy(buffer->data + buffer->end, data, length);
|
||||
//copy_from_user(buffer->data + buffer->end, data, length);
|
||||
|
||||
buffer->end += length;
|
||||
|
||||
if (buffer->start < 0)
|
||||
buffer->start = 0;
|
||||
|
||||
if (buffer->end >= buffer->length)
|
||||
buffer->end = 0;
|
||||
|
||||
if (buffer->status != FLAG_READING)
|
||||
buffer->position = buffer->start;
|
||||
}
|
||||
|
||||
void ReadBuffer(struct tRingBuffer *buffer,
|
||||
byte *data,
|
||||
unsigned long *length)
|
||||
{
|
||||
if (buffer->start < buffer->end) {
|
||||
*length = buffer->end - buffer->start;
|
||||
memcpy(data, buffer->data + buffer->start, *length);
|
||||
//copy_to_user(data, (buffer->data + buffer->start), *length);
|
||||
} else {
|
||||
*length = buffer->length - buffer->start;
|
||||
memcpy(data, buffer->data + buffer->start, *length);
|
||||
memcpy(data + *length, buffer->data, buffer->end);
|
||||
//copy_to_user(data, (buffer->data + buffer->start), *length);
|
||||
//copy_to_user(data + *length, (buffer->data), buffer->end);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadBufferByPosition(struct tRingBuffer *buffer,
|
||||
byte *data,
|
||||
unsigned long *length,
|
||||
unsigned long start,
|
||||
unsigned long end)
|
||||
{
|
||||
if (start < end) {
|
||||
*length = end - start;
|
||||
|
||||
if (*length >= PERFLOG_PACKET_SIZE) {
|
||||
*length = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(data, buffer->data + start, *length);
|
||||
} else if (buffer->length > start) {
|
||||
*length = buffer->length - start;
|
||||
|
||||
if ((*length + end) >= PERFLOG_PACKET_SIZE) {
|
||||
*length = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(data, buffer->data + start, *length);
|
||||
memcpy(data + *length, buffer->data, end);
|
||||
} else {
|
||||
*length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GetNext(struct tRingBuffer *buffer)
|
||||
{
|
||||
int bstart = (buffer->position + HEADER_SIZE - 1);
|
||||
int cur_length = *(buffer->data + bstart % buffer->length);
|
||||
|
||||
buffer->position += HEADER_SIZE + cur_length;
|
||||
buffer->position %= buffer->length;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
|
||||
static const struct proc_ops kperfmon_fops = {
|
||||
.proc_open = kperfmon_open,
|
||||
.proc_read = kperfmon_read,
|
||||
.proc_write = kperfmon_write,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations kperfmon_fops = {
|
||||
.read = kperfmon_read,
|
||||
.write = kperfmon_write,
|
||||
};
|
||||
#endif
|
||||
|
||||
void set_kperfmon_debugger_function(char *writebuffer)
|
||||
{
|
||||
buffer.debugger = !buffer.debugger;
|
||||
|
||||
pr_info("%s() - buffer.debugger : %d\n",
|
||||
__func__,
|
||||
(int)buffer.debugger);
|
||||
}
|
||||
|
||||
void process_version_function(char *writebuffer)
|
||||
{
|
||||
struct t_before_print *pprinter = NULL;
|
||||
int length = 0;
|
||||
|
||||
if (writebuffer == NULL)
|
||||
return;
|
||||
|
||||
pprinter = kmalloc(sizeof(struct t_before_print), GFP_ATOMIC);
|
||||
|
||||
if (pprinter == NULL)
|
||||
return;
|
||||
|
||||
length = strlen(writebuffer) + 1;
|
||||
pprinter->pdata = kmalloc(length, GFP_ATOMIC);
|
||||
|
||||
if (pprinter->pdata == NULL) {
|
||||
kfree(pprinter);
|
||||
return;
|
||||
}
|
||||
|
||||
strlcpy(pprinter->pdata, writebuffer, length);
|
||||
|
||||
list_add_tail(&pprinter->list, &before_print_list);
|
||||
}
|
||||
|
||||
int ops_write_buffer(struct tRingBuffer *buffer,
|
||||
byte *writebuffer, unsigned long length)
|
||||
{
|
||||
unsigned long DataLength;
|
||||
|
||||
if (buffer == NULL)
|
||||
return length;
|
||||
|
||||
if (writebuffer[HEADER_SIZE - 1] > PERFLOG_BUFF_STR_MAX_SIZE)
|
||||
writebuffer[HEADER_SIZE - 1] = PERFLOG_BUFF_STR_MAX_SIZE;
|
||||
|
||||
DataLength = writebuffer[HEADER_SIZE - 1] + HEADER_SIZE;
|
||||
|
||||
mutex_lock(&buffer->mutex);
|
||||
WriteBuffer(buffer, writebuffer, DataLength);
|
||||
mutex_unlock(&buffer->mutex);
|
||||
#if defined(KPERFMON_DEBUG)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 110 ; i++) {
|
||||
pr_info("%s(buffer.data[%d] : %c\n",
|
||||
__func__,
|
||||
i,
|
||||
buffer.data[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return length;
|
||||
}
|
||||
|
||||
int ops_process_command(struct tRingBuffer *buffer,
|
||||
byte *writebuffer, unsigned long length)
|
||||
{
|
||||
int idx;
|
||||
int max_commands = (int)(sizeof(commands) / sizeof(struct t_command));
|
||||
|
||||
for (idx = 0 ; idx < max_commands ; idx++) {
|
||||
int cmd_length = strlen(commands[idx].command);
|
||||
|
||||
if (cmd_length >= HEADER_SIZE + PERFLOG_BUFF_STR_MAX_SIZE)
|
||||
continue;
|
||||
|
||||
if (!strncmp(writebuffer, commands[idx].command, cmd_length)
|
||||
&& commands[idx].func != NULL
|
||||
&& strlen(writebuffer) > cmd_length) {
|
||||
commands[idx].func(writebuffer);
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int kperfmon_open(struct inode *finode, struct file *filp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t kperfmon_write(struct file *filp,
|
||||
const char __user *data,
|
||||
size_t length,
|
||||
loff_t *loff_data)
|
||||
{
|
||||
byte writebuffer[HEADER_SIZE + PERFLOG_BUFF_STR_MAX_SIZE + SH_IDX_PACKET + 1] = {0, };
|
||||
unsigned long DataLength = length;
|
||||
int max_write_ops = (int)(sizeof(write_opts) / sizeof(void *));
|
||||
int type_of_data;
|
||||
|
||||
if (!buffer.data) {
|
||||
pr_info("%s() - Error buffer allocation is failed!!!\n",
|
||||
__func__);
|
||||
return length;
|
||||
}
|
||||
|
||||
if (length <= 0) {
|
||||
pr_info("%s() - Error length : %d", __func__, (int) length);
|
||||
return length;
|
||||
}
|
||||
|
||||
if (DataLength > (HEADER_SIZE + PERFLOG_BUFF_STR_MAX_SIZE + SH_IDX_PACKET))
|
||||
DataLength = HEADER_SIZE + PERFLOG_BUFF_STR_MAX_SIZE + SH_IDX_PACKET;
|
||||
|
||||
if (copy_from_user(writebuffer, data, DataLength))
|
||||
return length;
|
||||
|
||||
// [[[ This will be replaced with below code
|
||||
type_of_data = writebuffer[SH_TYPE];
|
||||
|
||||
if (type_of_data < max_write_ops && type_of_data >= 0)
|
||||
return write_opts[type_of_data](&buffer,
|
||||
writebuffer + SH_IDX_PACKET,
|
||||
DataLength - SH_IDX_PACKET);
|
||||
// This will be replaced with below code ]]]
|
||||
|
||||
type_of_data -= (int)'0';
|
||||
|
||||
if (type_of_data < max_write_ops && type_of_data >= 0)
|
||||
return write_opts[type_of_data](&buffer,
|
||||
writebuffer + SH_IDX_PACKET,
|
||||
DataLength - SH_IDX_PACKET);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
ssize_t kperfmon_read(struct file *filp,
|
||||
char __user *data,
|
||||
size_t count,
|
||||
loff_t *loff_data)
|
||||
{
|
||||
unsigned long length;
|
||||
byte readbuffer[READ_BUFFER_SIZE] = {0, };
|
||||
union _uPLogPacket readlogpacket;
|
||||
char timestamp[32] = {0, };
|
||||
|
||||
unsigned long start = 0;
|
||||
unsigned long end = 0;
|
||||
|
||||
if (!buffer.data) {
|
||||
pr_info("%s() Error buffer allocation is failed!\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
#if defined(USE_MONITOR)
|
||||
if (buffer.position == buffer.start) {
|
||||
char mutex_log[PERFLOG_BUFF_STR_MAX_SIZE + 1] = {0, };
|
||||
int i, idx_mutex_log = 0;
|
||||
|
||||
idx_mutex_log += snprintf((mutex_log + idx_mutex_log),
|
||||
PERFLOG_BUFF_STR_MAX_SIZE - idx_mutex_log,
|
||||
"mutex test ");
|
||||
|
||||
for (i = 0;
|
||||
i <= MAX_MUTEX_RAWDATA &&
|
||||
idx_mutex_log < (PERFLOG_BUFF_STR_MAX_SIZE - 20);
|
||||
i++) {
|
||||
|
||||
int digit, flag = 0;
|
||||
|
||||
mutex_log[idx_mutex_log++] = '[';
|
||||
idx_mutex_log += snprintf((mutex_log + idx_mutex_log),
|
||||
PERFLOG_BUFF_STR_MAX_SIZE - idx_mutex_log,
|
||||
"%d",
|
||||
i);
|
||||
mutex_log[idx_mutex_log++] = ']';
|
||||
mutex_log[idx_mutex_log++] = ':';
|
||||
//idx_mutex_log += snprintf((mutex_log + idx_mutex_log),
|
||||
// PERFLOG_BUFF_STR_MAX_SIZE - idx_mutex_log,
|
||||
// "%d",
|
||||
// mutex_rawdata[i]);
|
||||
//mutex_rawdata[i][1] = 99999999;
|
||||
for (digit = (MAX_MUTEX_RAWDATA_DIGIT-1) ; digit >= 0 ; digit--) {
|
||||
if (flag) {
|
||||
idx_mutex_log += snprintf((mutex_log + idx_mutex_log),
|
||||
PERFLOG_BUFF_STR_MAX_SIZE - idx_mutex_log,
|
||||
"%08u",
|
||||
mutex_rawdata[i][digit]);
|
||||
} else {
|
||||
if (mutex_rawdata[i][digit] > 0) {
|
||||
idx_mutex_log += snprintf((mutex_log + idx_mutex_log),
|
||||
PERFLOG_BUFF_STR_MAX_SIZE - idx_mutex_log,
|
||||
"%u",
|
||||
mutex_rawdata[i][digit]);
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
mutex_log[idx_mutex_log++] = '0';
|
||||
|
||||
mutex_log[idx_mutex_log++] = ' ';
|
||||
}
|
||||
|
||||
_perflog(PERFLOG_EVT, PERFLOG_MUTEX, mutex_log);
|
||||
}
|
||||
#endif
|
||||
buffer.status = FLAG_READING;
|
||||
|
||||
mutex_lock(&buffer.mutex);
|
||||
|
||||
if (buffer.position == buffer.start) {
|
||||
|
||||
if (before_list_cur_pos !=
|
||||
list_last_entry(&before_print_list, typeof(*before_list_cur_pos), list)) {
|
||||
before_list_cur_pos = list_next_entry(before_list_cur_pos, list);
|
||||
|
||||
if (before_list_cur_pos != 0 && before_list_cur_pos->pdata != 0) {
|
||||
int length = snprintf(readbuffer,
|
||||
READ_BUFFER_SIZE,
|
||||
"%s\n",
|
||||
(char *) before_list_cur_pos->pdata);
|
||||
|
||||
if (length <= 0 || copy_to_user(data, readbuffer, length)) {
|
||||
pr_info("%s(copy_to_user(4) returned > 0)\n", __func__);
|
||||
mutex_unlock(&buffer.mutex);
|
||||
buffer.status = FLAG_NOTHING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mutex_unlock(&buffer.mutex);
|
||||
return length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.position == buffer.end || buffer.start < 0) {
|
||||
buffer.position = buffer.start;
|
||||
mutex_unlock(&buffer.mutex);
|
||||
buffer.status = FLAG_NOTHING;
|
||||
before_list_cur_pos
|
||||
= list_first_entry(&before_print_list, typeof(*before_list_cur_pos), list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = buffer.position;
|
||||
GetNext(&buffer);
|
||||
end = buffer.position;
|
||||
|
||||
//printk("kperfmon_read(start : %d, end : %d)\n", (int)start, (int)end);
|
||||
|
||||
if (start == end) {
|
||||
buffer.position = buffer.start;
|
||||
mutex_unlock(&buffer.mutex);
|
||||
buffer.status = FLAG_NOTHING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//ReadPacket.raw = &rawpacket;
|
||||
ReadBufferByPosition(&buffer, readlogpacket.stream, &length, start, end);
|
||||
mutex_unlock(&buffer.mutex);
|
||||
//printk(KERN_INFO "kperfmon_read(length : %d)\n", (int)length);
|
||||
//readlogpacket.stream[length++] = '\n';
|
||||
|
||||
if (length >= PERFLOG_PACKET_SIZE) {
|
||||
length = PERFLOG_PACKET_SIZE - 1;
|
||||
} else if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
readlogpacket.stream[length] = 0;
|
||||
|
||||
#if NOT_USED
|
||||
change2localtime(timestamp, readlogpacket.itemes.timestemp_sec);
|
||||
#else
|
||||
snprintf(timestamp, 32, "%02d-%02d %02d:%02d:%02d.%03d",
|
||||
readlogpacket.itemes.timestamp.month,
|
||||
readlogpacket.itemes.timestamp.day,
|
||||
readlogpacket.itemes.timestamp.hour,
|
||||
readlogpacket.itemes.timestamp.minute,
|
||||
readlogpacket.itemes.timestamp.second,
|
||||
readlogpacket.itemes.timestamp.msecond);
|
||||
|
||||
if (readlogpacket.itemes.type >= OlogTestEnum_Type_maxnum
|
||||
|| readlogpacket.itemes.type < 0) {
|
||||
readlogpacket.itemes.type = PERFLOG_LOG;
|
||||
}
|
||||
|
||||
if (readlogpacket.itemes.id >= OlogTestEnum_ID_maxnum
|
||||
|| readlogpacket.itemes.id < 0) {
|
||||
readlogpacket.itemes.id = PERFLOG_UNKNOWN;
|
||||
}
|
||||
|
||||
length = snprintf(readbuffer, READ_BUFFER_SIZE,
|
||||
"[%s %d %5d %5d (%3d)][%s][%s] %s\n",
|
||||
timestamp,
|
||||
readlogpacket.itemes.type,
|
||||
readlogpacket.itemes.pid,
|
||||
readlogpacket.itemes.tid,
|
||||
readlogpacket.itemes.context_length,
|
||||
OlogTestEnum_Type_strings[readlogpacket.itemes.type],
|
||||
OlogTestEnum_ID_strings[readlogpacket.itemes.id],
|
||||
readlogpacket.itemes.context_buffer);
|
||||
|
||||
|
||||
if (length > count)
|
||||
length = count;
|
||||
|
||||
if (buffer.debugger && count > DEBUGGER_SIZE) {
|
||||
char debugger[DEBUGGER_SIZE] = "______________________________";
|
||||
|
||||
snprintf(debugger, DEBUGGER_SIZE, "S:%010lu_E:%010lu_____", start, end);
|
||||
|
||||
if (length + DEBUGGER_SIZE > count)
|
||||
length = count - DEBUGGER_SIZE;
|
||||
|
||||
if (copy_to_user(data, debugger, strnlen(debugger, DEBUGGER_SIZE))) {
|
||||
pr_info("%s(copy_to_user(1) returned > 0)\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (copy_to_user(data + DEBUGGER_SIZE, readbuffer, length)) {
|
||||
pr_info("%s(copy_to_user(2) returned > 0)\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
length += DEBUGGER_SIZE;
|
||||
} else {
|
||||
if (length <= 0 || copy_to_user(data, readbuffer, length)) {
|
||||
pr_info("%s(copy_to_user(3) returned > 0)\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//printk(KERN_INFO "kperfmon_read(count : %d)\n", count);
|
||||
|
||||
|
||||
return length;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int __init kperfmon_init(void)
|
||||
{
|
||||
struct proc_dir_entry *entry;
|
||||
// char kperfmon_version[KPERFMON_VERSION_LENGTH] = {0, };
|
||||
|
||||
CreateBuffer(&buffer, BUFFER_SIZE);
|
||||
|
||||
if (!buffer.data) {
|
||||
pr_info("%s() - Error buffer allocation is failed!!!\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
entry = proc_create(PROC_NAME, 0664, NULL, &kperfmon_fops);
|
||||
|
||||
if (!entry) {
|
||||
pr_info("%s() - Error creating entry in proc failed!!!\n", __func__);
|
||||
DestroyBuffer(&buffer);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/*dbg_level_is_low = (sec_debug_level() == ANDROID_DEBUG_LEVEL_LOW);*/
|
||||
|
||||
INIT_LIST_HEAD(&before_print_list);
|
||||
before_list_cur_pos =
|
||||
list_first_entry(&before_print_list, typeof(*before_list_cur_pos), list);
|
||||
process_version_function(" ");
|
||||
// snprintf(kperfmon_version, KPERFMON_VERSION_LENGTH, "kperfmon_version [1.0.1] kperfmon_read : 0x%x, kperfmon_write : 0x%x", kperfmon_read, kperfmon_write);
|
||||
// process_version_function(kperfmon_version);
|
||||
|
||||
pr_info("%s()\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit kperfmon_exit(void)
|
||||
{
|
||||
DestroyBuffer(&buffer);
|
||||
pr_info("%s()\n", __func__);
|
||||
}
|
||||
|
||||
#if defined(USE_WORKQUEUE)
|
||||
static void ologk_workqueue_func(struct work_struct *work)
|
||||
{
|
||||
struct t_ologk_work *workqueue = (struct t_ologk_work *)work;
|
||||
|
||||
if (work) {
|
||||
mutex_lock(&buffer.mutex);
|
||||
WriteBuffer(&buffer,
|
||||
workqueue->writelogpacket.stream,
|
||||
PERFLOG_HEADER_SIZE + workqueue->writelogpacket.itemes.context_length);
|
||||
mutex_unlock(&buffer.mutex);
|
||||
|
||||
kfree((void *)work);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
|
||||
static inline void do_gettimeofday2(struct timeval *tv)
|
||||
{
|
||||
struct timespec64 now;
|
||||
|
||||
ktime_get_real_ts64(&now);
|
||||
tv->tv_sec = now.tv_sec;
|
||||
tv->tv_usec = now.tv_nsec/1000;
|
||||
}
|
||||
//#endif /* LINUX_VER >= 5.0 */
|
||||
|
||||
void _perflog(int type, int logid, const char *fmt, ...)
|
||||
{
|
||||
#if !defined(USE_WORKQUEUE)
|
||||
union _uPLogPacket writelogpacket;
|
||||
#endif
|
||||
struct rtc_time tm;
|
||||
struct timeval time;
|
||||
unsigned long local_time;
|
||||
#if defined(USE_WORKQUEUE)
|
||||
struct t_ologk_work *workqueue = 0;
|
||||
#endif
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
if (buffer.data == 0) {
|
||||
va_end(args);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(USE_WORKQUEUE)
|
||||
workqueue = kmalloc(sizeof(struct t_ologk_work), GFP_ATOMIC);
|
||||
|
||||
if (workqueue) {
|
||||
struct _PLogPacket *pitemes = &workqueue->writelogpacket.itemes;
|
||||
|
||||
INIT_WORK((struct work_struct *)workqueue, ologk_workqueue_func);
|
||||
|
||||
do_gettimeofday2(&time);
|
||||
local_time = (u32)(time.tv_sec - (sys_tz.tz_minuteswest * 60));
|
||||
rtc_time_to_tm(local_time, &tm);
|
||||
|
||||
//printk(" @ (%04d-%02d-%02d %02d:%02d:%02d)\n",
|
||||
// tm.tm_year + 1900,
|
||||
// tm.tm_mon + 1,
|
||||
// tm.tm_mday,
|
||||
// tm.tm_hour,
|
||||
// tm.tm_min,
|
||||
// tm.tm_sec);
|
||||
|
||||
pitemes->timestamp.month = tm.tm_mon + 1;
|
||||
pitemes->timestamp.day = tm.tm_mday;
|
||||
pitemes->timestamp.hour = tm.tm_hour;
|
||||
pitemes->timestamp.minute = tm.tm_min;
|
||||
pitemes->timestamp.second = tm.tm_sec;
|
||||
pitemes->timestamp.msecond = time.tv_usec / 1000;
|
||||
pitemes->type = PERFLOG_LOG;
|
||||
pitemes->id = logid;
|
||||
pitemes->pid = current->pid;//getpid();
|
||||
pitemes->tid = 0;//gettid();
|
||||
pitemes->context_length = vscnprintf(
|
||||
pitemes->context_buffer,
|
||||
PERFLOG_BUFF_STR_MAX_SIZE,
|
||||
fmt,
|
||||
args);
|
||||
|
||||
if (pitemes->context_length > PERFLOG_BUFF_STR_MAX_SIZE)
|
||||
pitemes->context_length = PERFLOG_BUFF_STR_MAX_SIZE;
|
||||
|
||||
schedule_work((struct work_struct *)workqueue);
|
||||
|
||||
//{
|
||||
// struct timeval end_time;
|
||||
// do_gettimeofday2(&end_time);
|
||||
// printk("ologk() execution time with workqueue : %ld us ( %ld - %ld )\n",
|
||||
// end_time.tv_usec - time.tv_usec,
|
||||
// end_time.tv_usec,
|
||||
// time.tv_usec);
|
||||
//}
|
||||
} else {
|
||||
pr_info("%s : workqueue is not working\n", __func__);
|
||||
}
|
||||
|
||||
#else
|
||||
do_gettimeofday2(&time);
|
||||
local_time = (u32)(time.tv_sec - (sys_tz.tz_minuteswest * 60));
|
||||
rtc_time_to_tm(local_time, &tm);
|
||||
|
||||
//printk(" @ (%04d-%02d-%02d %02d:%02d:%02d)\n",
|
||||
// tm.tm_year + 1900,
|
||||
// tm.tm_mon + 1,
|
||||
// tm.tm_mday,
|
||||
// tm.tm_hour,
|
||||
// tm.tm_min,
|
||||
// tm.tm_sec);
|
||||
|
||||
writelogpacket.itemes.timestamp.month = tm.tm_mon + 1;
|
||||
writelogpacket.itemes.timestamp.day = tm.tm_mday;
|
||||
writelogpacket.itemes.timestamp.hour = tm.tm_hour;
|
||||
writelogpacket.itemes.timestamp.minute = tm.tm_min;
|
||||
writelogpacket.itemes.timestamp.second = tm.tm_sec;
|
||||
writelogpacket.itemes.timestamp.msecond = time.tv_usec / 1000;
|
||||
writelogpacket.itemes.type = type;
|
||||
writelogpacket.itemes.pid = current->pid;//getpid();
|
||||
writelogpacket.itemes.tid = 0;//gettid();
|
||||
writelogpacket.itemes.context_length
|
||||
= vscnprintf(writelogpacket.itemes.context_buffer,
|
||||
PERFLOG_BUFF_STR_MAX_SIZE,
|
||||
fmt,
|
||||
args);
|
||||
|
||||
if (writelogpacket.itemes.context_length > PERFLOG_BUFF_STR_MAX_SIZE)
|
||||
writelogpacket.itemes.context_length = PERFLOG_BUFF_STR_MAX_SIZE;
|
||||
|
||||
mutex_lock(&buffer.mutex);
|
||||
WriteBuffer(&buffer,
|
||||
writelogpacket.stream,
|
||||
PERFLOG_HEADER_SIZE + writelogpacket.itemes.context_length);
|
||||
mutex_unlock(&buffer.mutex);
|
||||
|
||||
//{
|
||||
// struct timeval end_time;
|
||||
// do_gettimeofday2(&end_time);
|
||||
// printk(KERN_INFO "ologk() execution time : %ld us ( %ld - %ld )\n",
|
||||
// end_time.tv_usec - time.tv_usec,
|
||||
// end_time.tv_usec, time.tv_usec);
|
||||
//}
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
// void get_callstack(char *buffer, int max_size, int max_count)
|
||||
// {
|
||||
// struct stackframe frame;
|
||||
// struct task_struct *tsk = current;
|
||||
// //int len;
|
||||
|
||||
// if (!try_get_task_stack(tsk))
|
||||
// return;
|
||||
|
||||
// frame.fp = (unsigned long)__builtin_frame_address(0);
|
||||
// frame.pc = (unsigned long)get_callstack;
|
||||
|
||||
// #if defined(CONFIG_FUNCTION_GRAPH_TRACER)
|
||||
// frame.graph = tsk->curr_ret_stack;
|
||||
// #endif
|
||||
// #if NOT_USED // temporary for GKI
|
||||
// if (max_size > 0) {
|
||||
// int count = 0;
|
||||
|
||||
// max_count += 3;
|
||||
|
||||
// do {
|
||||
// if (count > 2) {
|
||||
// int len = snprintf(buffer, max_size, " %pS", (void *)frame.pc);
|
||||
|
||||
// max_size -= len;
|
||||
// buffer += len;
|
||||
// }
|
||||
// count++;
|
||||
// } while (!unwind_frame(tsk, &frame) &&
|
||||
// max_size > 0 &&
|
||||
// max_count > count);
|
||||
|
||||
// put_task_stack(tsk);
|
||||
// }
|
||||
// #endif
|
||||
// }
|
||||
|
||||
void send_signal(void)
|
||||
{
|
||||
#if NOT_USED // temporary for GKI
|
||||
siginfo_t info;
|
||||
|
||||
info.si_signo = SIGNAL_35;
|
||||
info.si_errno = SIGNAL_OLOG;
|
||||
info.si_code = SIGNAL_OLOG;
|
||||
send_sig_info(SIGNAL_35, &info, current);
|
||||
#endif
|
||||
}
|
||||
|
||||
void perflog_evt(int logid, int arg1)
|
||||
{
|
||||
#if defined(USE_MONITOR)
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
|
||||
int digit = 0;
|
||||
|
||||
do_gettimeofday2(&start_time);
|
||||
#endif
|
||||
if (arg1 < 0 || buffer.status != FLAG_NOTHING)
|
||||
return;
|
||||
|
||||
if (arg1 > MAX_MUTEX_RAWDATA) {
|
||||
char log_buffer[PERFLOG_BUFF_STR_MAX_SIZE];
|
||||
int len;
|
||||
u64 utime, stime;
|
||||
|
||||
task_cputime(current, &utime, &stime);
|
||||
|
||||
if (utime > 0) {
|
||||
len = snprintf(log_buffer,
|
||||
PERFLOG_BUFF_STR_MAX_SIZE,
|
||||
"%d jiffies",
|
||||
arg1);
|
||||
// Make some stuck problems to be needed to check
|
||||
// how many the mutex logging are occurred.
|
||||
// Refer to P200523-00343, P200523-01815.
|
||||
/*send_signal();*/
|
||||
|
||||
// get_callstack(log_buffer + len,
|
||||
// PERFLOG_BUFF_STR_MAX_SIZE - len,
|
||||
// /*(dbg_level_is_low ? 1 : 3)*/MAX_DEPTH_OF_CALLSTACK);
|
||||
_perflog(PERFLOG_EVT, PERFLOG_MUTEX, log_buffer);
|
||||
arg1 = MAX_MUTEX_RAWDATA;
|
||||
|
||||
//do_gettimeofday2(&end_time);
|
||||
//_perflog(PERFLOG_EVT,
|
||||
// PERFLOG_MUTEX,
|
||||
// "[MUTEX] processing time : %d",
|
||||
// end_time.tv_usec - start_time.tv_usec);
|
||||
}
|
||||
}
|
||||
#if defined(USE_MONITOR)
|
||||
for (digit = 0 ; digit < MAX_MUTEX_RAWDATA_DIGIT ; digit++) {
|
||||
mutex_rawdata[arg1][digit]++;
|
||||
if (mutex_rawdata[arg1][digit] >= DIGIT_UNIT)
|
||||
mutex_rawdata[arg1][digit] = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//EXPORT_SYMBOL(ologk);
|
||||
//EXPORT_SYMBOL(_perflog);
|
||||
//EXPORT_SYMBOL(perflog_evt);
|
||||
|
||||
module_init(kperfmon_init);
|
||||
module_exit(kperfmon_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Binse Park <unsang.park@samsung.com>");
|
||||
MODULE_DESCRIPTION("Performance Log(OLOG)");
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
#define FLAG_NOTHING 0
|
||||
#define FLAG_READING 1
|
||||
#define USE_WORKQUEUE 1
|
||||
#define NOT_USED 0
|
||||
|
||||
#define byte unsigned char
|
||||
|
||||
struct tRingBuffer {
|
||||
byte *data;
|
||||
long length;
|
||||
long start;
|
||||
long end;
|
||||
long position;
|
||||
|
||||
struct mutex mutex;
|
||||
long debugger;
|
||||
bool status;
|
||||
};
|
||||
|
||||
#if defined(USE_WORKQUEUE)
|
||||
struct t_ologk_work {
|
||||
struct work_struct ologk_work;
|
||||
union _uPLogPacket writelogpacket;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct t_command {
|
||||
char *command;
|
||||
void (*func)(char *writebuffer);
|
||||
};
|
||||
|
||||
#if defined(USE_MONITOR)
|
||||
unsigned long mutex_rawdata[MAX_MUTEX_RAWDATA + 1][MAX_MUTEX_RAWDATA_DIGIT] = {{0, },};
|
||||
#endif
|
||||
|
||||
int ops_write_buffer(struct tRingBuffer *buffer,
|
||||
byte *data, unsigned long length);
|
||||
int ops_process_command(struct tRingBuffer *buffer,
|
||||
byte *data, unsigned long length);
|
||||
|
||||
enum {
|
||||
SH_TYPE_PACKET,
|
||||
SH_TYPE_COMMAND,
|
||||
};
|
||||
|
||||
enum {
|
||||
SH_TYPE,
|
||||
SH_IDX_PACKET
|
||||
};
|
||||
|
||||
int (*write_opts[])(struct tRingBuffer *buffer,
|
||||
byte *data, unsigned long length)
|
||||
= {
|
||||
ops_write_buffer,
|
||||
ops_process_command,
|
||||
};
|
||||
|
||||
void set_kperfmon_debugger_function(char *writebuffer);
|
||||
void process_version_function(char *writebuffer);
|
||||
|
||||
struct t_command commands[] = {
|
||||
{"kperfmon_debugger", set_kperfmon_debugger_function},
|
||||
{"java_version", process_version_function},
|
||||
{"nativelib_version", process_version_function},
|
||||
{"perfmond_version", process_version_function},
|
||||
};
|
||||
|
||||
struct t_before_print {
|
||||
void *pdata;
|
||||
int (*func)(char *read_buffer);
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
void CreateBuffer(struct tRingBuffer *buffer,
|
||||
unsigned long length);
|
||||
void DestroyBuffer(struct tRingBuffer *buffer);
|
||||
void WriteBuffer(struct tRingBuffer *buffer,
|
||||
byte *data, unsigned long length);
|
||||
void GetNext(struct tRingBuffer *buffer);
|
||||
void ReadBuffer(struct tRingBuffer *buffer,
|
||||
byte *data,
|
||||
unsigned long *length);
|
||||
int kperfmon_open(struct inode *, struct file *);
|
||||
ssize_t kperfmon_write(struct file *filp,
|
||||
const char __user *data,
|
||||
size_t length,
|
||||
loff_t *loff_data);
|
||||
ssize_t kperfmon_read(struct file *filp,
|
||||
char __user *data,
|
||||
size_t count,
|
||||
loff_t *loff_data);
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
// Generated by the protocol buffer compiler for perflog!! DO NOT EDIT!
|
||||
#ifndef _OLOG_PROTOCOL_BUFFER_H_
|
||||
#define _OLOG_PROTOCOL_BUFFER_H_
|
||||
|
||||
//EnumGenerator::GenerateDefinition in perflog_enum.cc
|
||||
enum OlogTestEnum_Type {
|
||||
PERFLOG_DEF = 0,
|
||||
PERFLOG_LOG = 1,
|
||||
PERFLOG_EVT = 2,
|
||||
PERFLOG_WRN = 3,
|
||||
PERFLOG_CRI = 4
|
||||
};
|
||||
#if defined(KPERFMON_KERNEL)
|
||||
int OlogTestEnum_Type_maxnum = 5;
|
||||
char * OlogTestEnum_Type_strings[5] = {
|
||||
"DEF",
|
||||
"LOG",
|
||||
"EVT",
|
||||
"WRN",
|
||||
"CRI"
|
||||
};
|
||||
#endif //KPERFMON_KERNEL
|
||||
//EnumGenerator::GenerateDefinition in perflog_enum.cc
|
||||
enum OlogTestEnum_ID {
|
||||
PERFLOG_UNKNOWN = 0,
|
||||
PERFLOG_LCDV = 2,
|
||||
PERFLOG_ARGOS = 3,
|
||||
PERFLOG_APPLAUNCH = 4,
|
||||
PERFLOG_LOADAPK = 5,
|
||||
PERFLOG_MAINLOOPER = 6,
|
||||
PERFLOG_EXCESSIVECPUUSAGE = 7,
|
||||
PERFLOG_ACTIVITYSLOW = 8,
|
||||
PERFLOG_BROADCAST = 9,
|
||||
PERFLOG_STORE = 10,
|
||||
PERFLOG_CPUTOP = 11,
|
||||
PERFLOG_LCD = 12,
|
||||
PERFLOG_CPU = 13,
|
||||
PERFLOG_LOCKCONTENTION = 14,
|
||||
PERFLOG_CPUFREQ = 15,
|
||||
PERFLOG_MEMPRESSURE = 16,
|
||||
PERFLOG_INPUTD = 17,
|
||||
PERFLOG_AMPSS = 18,
|
||||
PERFLOG_SERVICEMANAGERSLOW = 19,
|
||||
PERFLOG_IPCSTARVE = 20,
|
||||
PERFLOG_SCREENSHOT = 21,
|
||||
PERFLOG_MUTEX = 22,
|
||||
PERFLOG_SYSTEMSERVER = 23,
|
||||
PERFLOG_PERFETTOLOGGINGENABLED = 24,
|
||||
PERFLOG_BIGDATA = 25,
|
||||
PERFLOG_PSI = 26,
|
||||
PERFLOG_JANK = 27
|
||||
};
|
||||
#if defined(KPERFMON_KERNEL)
|
||||
int OlogTestEnum_ID_maxnum = 28;
|
||||
char * OlogTestEnum_ID_strings[28] = {
|
||||
"UNKNOWN",
|
||||
" ",
|
||||
"LCDV",
|
||||
"ARGOS",
|
||||
"APPLAUNCH",
|
||||
"LOADAPK",
|
||||
"MAINLOOPER",
|
||||
"EXCESSIVECPUUSAGE",
|
||||
"ACTIVITYSLOW",
|
||||
"BROADCAST",
|
||||
"STORE",
|
||||
"CPUTOP",
|
||||
"LCD",
|
||||
"CPU",
|
||||
"LOCKCONTENTION",
|
||||
"CPUFREQ",
|
||||
"MEMPRESSURE",
|
||||
"INPUTD",
|
||||
"AMPSS",
|
||||
"SERVICEMANAGERSLOW",
|
||||
"IPCSTARVE",
|
||||
"SCREENSHOT",
|
||||
"MUTEX",
|
||||
"SYSTEMSERVER",
|
||||
"PERFETTOLOGGINGENABLED",
|
||||
"BIGDATA",
|
||||
"PSI",
|
||||
"JANK"
|
||||
};
|
||||
#endif //KPERFMON_KERNEL
|
||||
|
||||
#endif //_OLOG_PROTOCOL_BUFFER_H_
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#include <linux/ologk.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
|
||||
//void _perflog(int type, int logid, const char *fmt, ...) {
|
||||
//}
|
||||
|
||||
//void perflog_evt(int logid, int arg1) {
|
||||
//}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef _OLOG_KERNEL_H_
|
||||
#define _OLOG_KERNEL_H_
|
||||
|
||||
#include <linux/unistd.h>
|
||||
#include "olog.pb.h"
|
||||
|
||||
#define OLOG_CPU_FREQ_FILTER 1500000
|
||||
#define PERFLOG_MUTEX_THRESHOLD 20
|
||||
|
||||
#define ologk(...) _perflog(PERFLOG_LOG, PERFLOG_UNKNOWN, __VA_ARGS__)
|
||||
#define perflog(...) _perflog(PERFLOG_LOG, __VA_ARGS__)
|
||||
extern void _perflog(int type, int logid, const char *fmt, ...);
|
||||
extern void perflog_evt(int logid, int arg1);
|
||||
|
||||
#endif
|
|
@ -1,120 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Samsung's performance logging
|
||||
//
|
||||
// Copyright (c) 2014 Samsung Electronics Co., Ltd
|
||||
// http://www.samsung.com
|
||||
|
||||
#ifndef PERFLOG_H_
|
||||
#define PERFLOG_H_
|
||||
|
||||
#define PERFLOG_LOC __FILE__, __LINE__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "olog.pb.h"
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
|
||||
// extern FILE* perflog_fout;
|
||||
#define PERFLOG_PACKET_SIZE 256
|
||||
#define PERFLOG_HEADER_SIZE 24
|
||||
#define PERFLOG_BUFF_STR_MAX_SIZE (PERFLOG_PACKET_SIZE - PERFLOG_HEADER_SIZE)
|
||||
#define PERFLOG_BUFF_STR_MAX_SIZE_FOR_MULTILINE 4096
|
||||
#define PERFLOG_BUFF_STR_MAX_SIZE_FOR_EVTI PERFLOG_BUFF_STR_MAX_SIZE - PERFLOG_UINT16_SIZE
|
||||
#define PERFLOG_UINT16_SIZE 2
|
||||
#define PERFLOG_INT_SIZE 4
|
||||
|
||||
/* PerfLog Phase 2 :: header format modification
|
||||
should be changed to protobuff type
|
||||
*/
|
||||
typedef enum PerfLogAffectTag {
|
||||
AFFECT_K,
|
||||
AFFECT_F,
|
||||
AFFECT_A
|
||||
}PerfLogAffect;
|
||||
|
||||
typedef enum EvtNamingTag {
|
||||
NAMING_LockC,
|
||||
NAMING_AppLaunch,
|
||||
}EvtNamingTag;
|
||||
|
||||
typedef enum PerfLevelTag{
|
||||
LOW,
|
||||
MID,
|
||||
HIGH,
|
||||
CRITICAL
|
||||
}PerfLevelTag;
|
||||
|
||||
// ###############################################################################
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct Payload {
|
||||
int param1;
|
||||
int param2;
|
||||
char logbuffer[PERFLOG_BUFF_STR_MAX_SIZE + 1];
|
||||
};
|
||||
|
||||
struct LogPacket {
|
||||
#if defined(KPERFMON_KERNEL)
|
||||
struct timespec64 logtime;
|
||||
#else
|
||||
struct timespec logtime;
|
||||
#endif
|
||||
uint16 logtype;
|
||||
uint16 logid;
|
||||
uint16 pid;
|
||||
uint16 tid;
|
||||
struct Payload payload;
|
||||
};
|
||||
|
||||
struct _Timestamp {
|
||||
uint8 month;
|
||||
uint8 day;
|
||||
uint8 hour;
|
||||
uint8 minute;
|
||||
uint8 second;
|
||||
uint16 msecond;
|
||||
};
|
||||
|
||||
struct _PLogPacket {
|
||||
struct _Timestamp timestamp;
|
||||
uint16 pid;
|
||||
uint16 tid;
|
||||
|
||||
uint8 type;
|
||||
uint8 id;
|
||||
|
||||
char pname[10];
|
||||
uint8 context_length;
|
||||
char context_buffer[PERFLOG_BUFF_STR_MAX_SIZE + 1];
|
||||
};
|
||||
|
||||
union _uPLogPacket {
|
||||
struct _PLogPacket itemes;
|
||||
char stream[PERFLOG_HEADER_SIZE + PERFLOG_BUFF_STR_MAX_SIZE];
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
// Start API
|
||||
int perflog_sending_log_via_socket(uint16 type, uint16 logid, int param1, int param2, char const *str);
|
||||
|
||||
int perflog_write(char const * fmt, ...);
|
||||
|
||||
int perflog_write_log(uint16 type, uint16 logid, char const * fmt, ...);
|
||||
|
||||
int perflog_write_evt(uint16 maintype, uint16 logid, uint16 param1, char const * fmt, ...);
|
||||
|
||||
// int perflog_getlog(char **buff);
|
||||
// End API
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* #ifdef __cplusplus */
|
||||
|
||||
#endif
|
|
@ -28,7 +28,6 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/sec_argos.h>
|
||||
#include <soc/samsung/exynos_pm_qos.h>
|
||||
//#include <linux/ologk.h>
|
||||
|
||||
#ifdef CONFIG_ARGOS_THROUGHPUT
|
||||
#include <linux/miscdevice.h>
|
||||
|
@ -717,11 +716,6 @@ static int argos_pm_qos_notify(struct notifier_block *nfb,
|
|||
cnode = &argos_pdata->devices[type];
|
||||
|
||||
prev_level = cnode->prev_level;
|
||||
#if 0
|
||||
pr_debug("%s name:%s, speed:%ldMbps\n", __func__, cnode->desc, speed);
|
||||
if (speed >= 300)
|
||||
perflog(PERFLOG_ARGOS, "name:%s, speed:%ldMbps", cnode->desc, speed);
|
||||
#endif
|
||||
|
||||
argos_blocked = cnode->argos_block;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue