mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-21 03:55:04 +00:00
decorator stress test
This commit is contained in:
parent
09ec663d2d
commit
59555c540e
196
repos/gems/run/decorator_stress.run
Normal file
196
repos/gems/run/decorator_stress.run
Normal file
@ -0,0 +1,196 @@
|
||||
#
|
||||
# Build
|
||||
#
|
||||
|
||||
set build_components {
|
||||
core init
|
||||
drivers/timer
|
||||
app/decorator
|
||||
server/nitpicker server/report_rom
|
||||
test/decorator_stress
|
||||
drivers/framebuffer drivers/pci drivers/input
|
||||
}
|
||||
|
||||
lappend_if [have_spec usb] build_components drivers/usb
|
||||
lappend_if [have_spec gpio] build_components drivers/gpio
|
||||
lappend_if [have_spec imx53] build_components drivers/platform
|
||||
lappend_if [have_spec exynos5] build_components drivers/platform
|
||||
lappend_if [have_spec platform_rpi] build_components drivers/platform
|
||||
|
||||
build $build_components
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Generate config
|
||||
#
|
||||
|
||||
append config {
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="CAP"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="SIGNAL"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>}
|
||||
|
||||
append_if [have_spec sdl] config {
|
||||
<start name="fb_sdl">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides>
|
||||
<service name="Input"/>
|
||||
<service name="Framebuffer"/>
|
||||
</provides>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec pci] config {
|
||||
<start name="pci_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="PCI"/></provides>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec framebuffer] config {
|
||||
<start name="fb_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec gpio] config {
|
||||
<start name="gpio_drv">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Gpio"/></provides>
|
||||
<config/>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec exynos5] config {
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Regulator"/></provides>
|
||||
<config/>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec platform_rpi] config {
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Platform"/></provides>
|
||||
<config/>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec imx53] config {
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Platform"/></provides>
|
||||
<config/>
|
||||
</start>
|
||||
<start name="input_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config/>
|
||||
</start> }
|
||||
|
||||
append_if [have_spec ps2] config {
|
||||
<start name="ps2_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
</start>}
|
||||
|
||||
append_if [expr ![have_spec ps2] && [have_spec usb]] config {
|
||||
<start name="usb_drv">
|
||||
<resource name="RAM" quantum="12M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
<config ehci="yes" uhci="yes" xhci="no"> <hid/> </config>
|
||||
</start> }
|
||||
|
||||
append config {
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="nitpicker">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Nitpicker"/></provides>
|
||||
<config>
|
||||
<report pointer="yes" />
|
||||
<global-key name="KEY_SCROLLLOCK" operation="xray" />
|
||||
<global-key name="KEY_SYSRQ" operation="kill" />
|
||||
<global-key name="KEY_PRINT" operation="kill" />
|
||||
<global-key name="KEY_F11" operation="kill" />
|
||||
<global-key name="KEY_F12" operation="xray" />
|
||||
</config>
|
||||
</start>
|
||||
<start name="report_rom">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides> <service name="ROM" />
|
||||
<service name="Report" /> </provides>
|
||||
<config>
|
||||
<rom>
|
||||
<policy label="decorator -> pointer"
|
||||
report="nitpicker -> pointer"/>
|
||||
<policy label="decorator -> window_layout"
|
||||
report="test-decorator_stress -> window_layout"/>
|
||||
</rom>
|
||||
</config>
|
||||
</start>
|
||||
<start name="test-decorator_stress">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
</start>
|
||||
<start name="decorator">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<route>
|
||||
<service name="ROM">
|
||||
<if-arg key="label" value="pointer" />
|
||||
<child name="report_rom" />
|
||||
</service>
|
||||
<service name="ROM">
|
||||
<if-arg key="label" value="window_layout" />
|
||||
<child name="report_rom" />
|
||||
</service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
install_config $config
|
||||
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init
|
||||
timer
|
||||
decorator
|
||||
nitpicker report_rom
|
||||
test-decorator_stress
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
}
|
||||
|
||||
# platform-specific modules
|
||||
lappend_if [have_spec linux] boot_modules fb_sdl
|
||||
lappend_if [have_spec pci] boot_modules pci_drv
|
||||
lappend_if [have_spec ps2] boot_modules ps2_drv
|
||||
lappend_if [have_spec framebuffer] boot_modules fb_drv
|
||||
lappend_if [have_spec usb] boot_modules usb_drv
|
||||
lappend_if [have_spec gpio] boot_modules gpio_drv
|
||||
lappend_if [have_spec imx53] boot_modules platform_drv
|
||||
lappend_if [have_spec exynos5] boot_modules platform_drv
|
||||
lappend_if [have_spec platform_rpi] boot_modules platform_drv
|
||||
lappend_if [have_spec imx53] boot_modules input_drv
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
append qemu_args " -m 256 "
|
||||
|
||||
run_genode_until forever
|
93
repos/gems/src/test/decorator_stress/main.cc
Normal file
93
repos/gems/src/test/decorator_stress/main.cc
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* \brief Stress test for decorator
|
||||
* \author Norman Feske
|
||||
* \date 2014-04-28
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/list.h>
|
||||
#include <util/geometry.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <os/reporter.h>
|
||||
#include <os/surface.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <math.h>
|
||||
|
||||
typedef Genode::Surface_base::Point Point;
|
||||
typedef Genode::Surface_base::Area Area;
|
||||
typedef Genode::Surface_base::Rect Rect;
|
||||
|
||||
|
||||
struct Param
|
||||
{
|
||||
float angle[4];
|
||||
|
||||
Param(float alpha, float beta, float gamma, float delta)
|
||||
: angle { alpha, beta, gamma, delta }
|
||||
{ }
|
||||
|
||||
Param operator + (Param const &other)
|
||||
{
|
||||
return Param(fmod(angle[0] + other.angle[0], M_PI*2),
|
||||
fmod(angle[1] + other.angle[1], M_PI*2),
|
||||
fmod(angle[2] + other.angle[2], M_PI*2),
|
||||
fmod(angle[3] + other.angle[3], M_PI*2));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void report_window_layout(Param param, Genode::Reporter &reporter)
|
||||
{
|
||||
|
||||
float w = 1024;
|
||||
float h = 768;
|
||||
|
||||
Genode::Reporter::Xml_generator xml(reporter, [&] ()
|
||||
{
|
||||
for (unsigned i = 1; i <= 10; i++) {
|
||||
|
||||
xml.node("window", [&] ()
|
||||
{
|
||||
xml.attribute("id", i);
|
||||
xml.attribute("xpos", w * (0.25 + sin(param.angle[0])/5));
|
||||
xml.attribute("ypos", h * (0.25 + sin(param.angle[1])/5));
|
||||
xml.attribute("width", w * (0.25 + sin(param.angle[2])/5));
|
||||
xml.attribute("height", h * (0.25 + sin(param.angle[3])/5));
|
||||
|
||||
if (i == 2)
|
||||
xml.attribute("focused", "yes");
|
||||
});
|
||||
|
||||
param = param + Param(2.2, 3.3, 4.4, 5.5);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Param param(0, 1, 2, 3);
|
||||
|
||||
Genode::Reporter window_layout_reporter("window_layout", 10*4096);
|
||||
window_layout_reporter.enabled(true);
|
||||
|
||||
static Timer::Connection timer;
|
||||
|
||||
for (;;) {
|
||||
|
||||
report_window_layout(param, window_layout_reporter);
|
||||
|
||||
param = param + Param(0.0331/2, 0.042/2, 0.051/2, 0.04/2);
|
||||
|
||||
timer.msleep(10);
|
||||
}
|
||||
return 0;
|
||||
}
|
6
repos/gems/src/test/decorator_stress/target.mk
Normal file
6
repos/gems/src/test/decorator_stress/target.mk
Normal file
@ -0,0 +1,6 @@
|
||||
TARGET = test-decorator_stress
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libm
|
||||
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
Loading…
Reference in New Issue
Block a user