Commit 0605bf00 authored by Daniel Bristot de Oliveira's avatar Daniel Bristot de Oliveira Committed by Steven Rostedt

rtla: Add osnoise tool

The osnoise tool is the interface for the osnoise tracer. The osnoise
tool will have multiple "modes" with different outputs. At this point,
no mode is included.

The osnoise.c includes the osnoise_context abstraction. It serves to
read-save-change-restore the default values from tracing/osnoise/
directory. When the context is deleted, the default values are restored.

It also includes some other helper functions for managing osnoise
tracer sessions.

With these bits and pieces in place, we can start adding some
functionality to rtla.

Link: https://lkml.kernel.org/r/2d44c21ff561f503b4c7b1813892761818118460.1639158831.git.bristot@kernel.org

Cc: Tao Zhou <tao.zhou@linux.dev>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: linux-rt-users@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent b1696371
......@@ -60,6 +60,8 @@ install:
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
$(INSTALL) rtla -m 755 $(DESTDIR)$(BINDIR)
$(STRIP) $(DESTDIR)$(BINDIR)/rtla
@test ! -f $(DESTDIR)$(BINDIR)/osnoise || rm $(DESTDIR)$(BINDIR)/osnoise
ln -s $(DESTDIR)$(BINDIR)/rtla $(DESTDIR)$(BINDIR)/osnoise
.PHONY: clean tarball
clean:
......
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0
#include "trace.h"
/*
* osnoise_context - read, store, write, restore osnoise configs.
*/
struct osnoise_context {
int flags;
int ref;
char *curr_cpus;
char *orig_cpus;
/* 0 as init value */
unsigned long long orig_runtime_us;
unsigned long long runtime_us;
/* 0 as init value */
unsigned long long orig_period_us;
unsigned long long period_us;
/* 0 as init value */
long long orig_timerlat_period_us;
long long timerlat_period_us;
/* -1 as init value because 0 is disabled */
long long orig_stop_us;
long long stop_us;
/* -1 as init value because 0 is disabled */
long long orig_stop_total_us;
long long stop_total_us;
/* -1 as init value because 0 is disabled */
long long orig_print_stack;
long long print_stack;
};
/*
* *_INIT_VALs are also invalid values, they are used to
* communicate errors.
*/
#define OSNOISE_OPTION_INIT_VAL (-1)
#define OSNOISE_TIME_INIT_VAL (0)
struct osnoise_context *osnoise_context_alloc(void);
int osnoise_get_context(struct osnoise_context *context);
void osnoise_put_context(struct osnoise_context *context);
int osnoise_set_cpus(struct osnoise_context *context, char *cpus);
void osnoise_restore_cpus(struct osnoise_context *context);
int osnoise_set_runtime_period(struct osnoise_context *context,
unsigned long long runtime,
unsigned long long period);
void osnoise_restore_runtime_period(struct osnoise_context *context);
int osnoise_set_stop_us(struct osnoise_context *context,
long long stop_us);
void osnoise_restore_stop_us(struct osnoise_context *context);
int osnoise_set_stop_total_us(struct osnoise_context *context,
long long stop_total_us);
void osnoise_restore_stop_total_us(struct osnoise_context *context);
int osnoise_set_timerlat_period_us(struct osnoise_context *context,
long long timerlat_period_us);
void osnoise_restore_timerlat_period_us(struct osnoise_context *context);
void osnoise_restore_print_stack(struct osnoise_context *context);
int osnoise_set_print_stack(struct osnoise_context *context,
long long print_stack);
/*
* osnoise_tool - osnoise based tool definition.
*/
struct osnoise_tool {
struct trace_instance trace;
struct osnoise_context *context;
void *data;
void *params;
time_t start_time;
};
void osnoise_destroy_tool(struct osnoise_tool *top);
struct osnoise_tool *osnoise_init_tool(char *tool_name);
struct osnoise_tool *osnoise_init_trace_tool(char *tracer);
int osnoise_main(int argc, char **argv);
......@@ -8,6 +8,8 @@
#include <string.h>
#include <stdio.h>
#include "osnoise.h"
/*
* rtla_usage - print rtla usage
*/
......@@ -22,6 +24,7 @@ static void rtla_usage(void)
" usage: rtla COMMAND ...",
"",
" commands:",
" osnoise - gives information about the operating system noise (osnoise)",
"",
NULL,
};
......@@ -39,7 +42,14 @@ static void rtla_usage(void)
*/
int run_command(int argc, char **argv, int start_position)
{
if (strcmp(argv[start_position], "osnoise") == 0) {
osnoise_main(argc-start_position, &argv[start_position]);
goto ran;
}
return 0;
ran:
return 1;
}
int main(int argc, char *argv[])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment