#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <l4/dope/dopelib.h>
#include <l4/dope/vscreen.h>
#include <l4/util/atomic.h>
#include <l4/util/bitops.h>
#include <l4/log/l4log.h>
#include "threadinfo.h"
#include "subwindow.h"
#include "jtop.h"
#include "startup.h"
#include "service.h"
#include "scope.h"
#include "os.h"
#include "debug.h"
Defines | |
#define | COLOR_BLACK 0x0000 |
#define | COLOR_GRAY 0x528A |
#define | COLOR_RED 0xF800 |
#define | COLOR_GREEN 0x07E0 |
Functions | |
static scope_t * | scope_alloc (void) |
Allocate a new scope. | |
static void | scope_free (scope_t *scope) |
Free an unlocked scope. | |
static void | scope_close (int id) |
static scope_t * | scope_by_nr (int id) |
static void | press_callback (dope_event *ev, void *arg) |
static void | scope_plotval (scope_t *scope, int idx) |
Plot a value of the scope, depending on the key. | |
static void | scope_rescale (scope_t *scope) |
Rescale a scope and redraw it. | |
static void | scope_newval (scope_t *scope, cputime_t val, cputime_t diff) |
Add new value to the scope window. | |
static void | scope_update (scope_t *scope) |
Obtain the values of the threads and update the graphics. | |
static void | scope_thread (void *arg) |
Scope thread-function. | |
int | scope_create (int id_parent, int width, int height) |
Generate a new window from the selected threads of a parent. | |
static void | scope_clear (scope_t *scope, int x) |
void | scope_plotxy (scope_t *scope, int x, int y, short color) |
void | scope_refresh (scope_t *scope, int x, int w) |
static char * | expbase_time2a (int e, int b, char buf[7]) |
static void | scope_rescale_time (scope_t *scope) |
Rescale a scope for displaying time. | |
static void | scope_rescale_load (scope_t *scope) |
Rescale a scope for displaying load. | |
int | scope_init (void) |
Variables | |
scope_t | scopes [SCOPE_COUNT] |
static scope_t * scope_alloc | ( | void | ) | [static] |
Allocate a new scope.
References gen_name().
Referenced by scope_create().
int scope_create | ( | int | id_parent, | |
int | width, | |||
int | height | |||
) |
Generate a new window from the selected threads of a parent.
No reference is held to the parent, so the parent can be destroyed when this function returned.
id_parent | Id of the parent disp. Used for getting the switch- setting. Set it to -1 to create the root-window. |
References disp_by_nr(), os_thread_create(), scope_alloc(), scope_free(), and scope_thread().
static void scope_free | ( | scope_t * | scope | ) | [static] |
Free an unlocked scope.
No references should be to the scope, it should be in init state. This function checks if the thread is still running, and exits if so. The thread regularly checks if it should exit (STATE_INIT), and calls scope_free then.
Referenced by scope_create(), and scope_thread().
static void scope_newval | ( | scope_t * | scope, | |
cputime_t | val, | |||
cputime_t | diff | |||
) | [static] |
Add new value to the scope window.
The value will be added to the set and drawn. Conditionally, a rescale of the window will be initiated.
val | accumulated thread time since last update | |
diff | overall time difference to the last update |
References scope_plotval(), and scope_rescale().
Referenced by scope_update().
static void scope_rescale | ( | scope_t * | scope | ) | [static] |
Rescale a scope and redraw it.
Depending on the key to correspronding rescale-function is called.
References scope_plotval(), scope_rescale_load(), and scope_rescale_time().
Referenced by scope_newval().
static void scope_thread | ( | void * | arg | ) | [static] |
Scope thread-function.
arg | the scope itself |
References os_msleep(), scope_free(), and scope_update().
Referenced by scope_create().