/demos/branches/xen/network/DatagramSender.java |
---|
0,0 → 1,35 |
import java.net.*; |
import java.util.*; |
public class DatagramSender { |
public static void main(String argv[]) throws Exception { |
long i = 0; |
DatagramSocket sender = new DatagramSocket(); |
InetAddress IP = InetAddress.getByName("192.168.121.2"); |
String line=("Inviato"); |
byte[] buffer = new byte[255]; |
byte[] buffer1 ; |
DatagramPacket packetr; |
while ( true ) { |
//DatagramPacket packet = new DatagramPacket(buffer, buffer.length); |
//System.out.println("In attesa di messaggi..."); |
//receiver.receive(packet); |
//String message = new String(packet.getData(), packet.getOffset(), packet.getLength()); |
//System.out.println("Messaggio ricevuto dall'host " + packet.getAddress() + " su porta " + packet.getPort() + ": " + message+" "+ i++); |
line="Inviato"+i; |
buffer1 = line.getBytes(); |
packetr = new DatagramPacket(buffer1, buffer1.length, IP, 100); |
sender.send(packetr); |
if(i++ % 10==0) |
System.out.println("Inviato"+i); |
Thread.sleep(508,0); |
//System.out.println(message+" "+ i++); |
} |
} |
} |
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: xen/network/notify.c |
=================================================================== |
--- xen/network/notify.c (nonexistent) |
+++ xen/network/notify.c (revision 1684) |
@@ -0,0 +1,149 @@ |
+/* |
+* Project: S.Ha.R.K. |
+* |
+* Coordinators: |
+* Giorgio Buttazzo <giorgio@sssup.it> |
+* Paolo Gai <pj@gandalf.sssup.it> |
+* |
+* Authors : |
+* Tullio Facchinetti <tullio.facchinetti@unipv.it> |
+* Luca M. Capisani <luca.capisani@unipv.it> |
+* |
+* Robotic Lab (Dipartimento di ingegneria informatica - Pavia - Italy) |
+* |
+* http://robot.unipv.it |
+* http://www.sssup.it |
+* http://retis.sssup.it |
+* http://shark.sssup.it |
+*/ |
+ |
+/* |
+* udp_notify demo: this simple demo shows how to set up a simple UDP/IP |
+* packet handler function in order to avoid busy waits or task creation |
+* for the packet receiver function. |
+* usage: after compiling this demo, with the "make" command, start it with: |
+* x net <loc_ip> <loc_port> |
+* where <loc_ip> stands for the local ip of the receiver host and |
+* <loc_port> stands for the local UDP port where the receiver listens. |
+*/ |
+ |
+/* |
+* This program is free software; you can redistribute it and/or modify |
+* it under the terms of the GNU General Public License as published by |
+* the Free Software Foundation; either version 2 of the License, or |
+* (at your option) any later version. |
+* |
+* This program is distributed in the hope that it will be useful, |
+* but WITHOUT ANY WARRANTY; without even the implied warranty of |
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+* GNU General Public License for more details. |
+* |
+* You should have received a copy of the GNU General Public License |
+* along with this program; if not, write to the Free Software |
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+* |
+*/ |
+ |
+#include <kernel/kern.h> |
+#include <drivers/udpip.h> |
+#include <string.h> //for strcpy() |
+#include <unistd.h> //for sleep() |
+#include "drivers/shark_keyb26.h" //for keyboard |
+ |
+ |
+//Received Packet Counter |
+long recvcount=0; |
+ |
+//The Internet Address of this Host |
+char local_ip[20]; |
+ |
+//A index for the receiver socket |
+int socket; |
+ |
+//Declaring a structure containing the receiver UDP port |
+UDP_ADDR local; |
+ |
+//UDP receiver handler: this function is called upon UDP packet received. |
+//No Busy waits are present. |
+int recvFun(int len, unsigned char *buff, void *p){ |
+ |
+ recvcount++; |
+ |
+ //Printing on screen the data contained, assuming that is text data |
+ cprintf("Packet # %ld, len %d: %s.\n",recvcount, len,buff); |
+ |
+ return 1; |
+} |
+ |
+/* Init the network stack */ |
+int init_network(char *local_ip) |
+{ |
+ //Declaring a network model and asigning the UDP/IP model; |
+ struct net_model m = net_base; |
+ |
+ |
+ //Setting up the UDP/IP stack, assigning a UDP/IP/Ethernet Network Model, |
+ //a host and a network broadcast address. |
+ net_setudpip(m,local_ip,"255.255.255.0"); |
+ |
+ //Initializing the network stack |
+ if (net_init(&m) != 1) { |
+ cprintf("Network: Init Error.\n"); |
+ return -1; |
+ } |
+ |
+ |
+ //Binding of the UDP port in the system network stack |
+ //without assigning a peer IP-list in the second parameter |
+ socket = udp_bind(&local, NULL); |
+ |
+ //Assigning a receiver notify handler called on packed received |
+ udp_notify(socket, &recvFun,NULL); |
+ |
+ return 0; |
+ |
+} |
+ |
+void program_key_end(KEY_EVT* e) |
+{ |
+ exit(1); |
+} |
+ |
+ |
+int main(int argc, char **argv) |
+{ |
+ //Assigning a CTRL+C exit key shortcut |
+ KEY_EVT k; |
+ k.flag = CNTL_BIT; |
+ k.scan = KEY_C; |
+ k.ascii = 'c'; |
+ k.status = KEY_PRESSED; |
+ keyb_hook(k,program_key_end,FALSE); |
+ |
+ if (argc==3){ |
+ //Copy the input parameters values into the UDP/IP stack |
+ strcpy(local_ip, argv[1]); |
+ |
+ //A local UDP port number where the receiver listens |
+ local.s_port=atoi(argv[2]); |
+ }else{ |
+ //The user has given a wrong number of parameters: |
+ cprintf("S.Ha.R.K. udp_notify usage: x net <localIP> <localUDPport>\n"); |
+ return(1); |
+ } |
+ |
+ cprintf("Initializing the network stack... \n"); |
+ |
+ //Initializing the network settings |
+ if (init_network(local_ip)) exit(1); |
+ |
+ cprintf("Waiting for packets on port %d... \n",local.s_port); |
+ |
+ //Waiting for packets |
+ while(1){ |
+ sleep(1); |
+ } |
+ |
+ |
+ return 0; |
+} |
/xen/network/notify.c |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: xen/network/makefile |
=================================================================== |
--- xen/network/makefile (nonexistent) |
+++ xen/network/makefile (revision 1684) |
@@ -0,0 +1,21 @@ |
+# |
+# |
+# |
+ |
+ifndef BASE |
+BASE=../.. |
+endif |
+include $(BASE)/config/config.mk |
+ |
+PROGS = net talk |
+ |
+include $(BASE)/config/example.mk |
+ |
+net: |
+ make -f $(SUBMAKE) BASE=$(BASE) APP=net INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__PCI__ __LINUXC26__ __INPUT__ __NET__" |
+ |
+talk: |
+ make -f $(SUBMAKE) BASE=$(BASE) APP=talk INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__PCI__ __LINUXC26__ __INPUT__ __NET__" |
+ |
+notify: |
+ make -f $(SUBMAKE) BASE=$(BASE) APP=notify INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__PCI__ __LINUXC26__ __INPUT__ __NET__" |
Index: xen/network/net.c |
=================================================================== |
--- xen/network/net.c (nonexistent) |
+++ xen/network/net.c (revision 1684) |
@@ -0,0 +1,99 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Giacomo Guidi <giacomo@gandalf.sssup.it> |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <kernel/kern.h> |
+#include <drivers/udpip.h> |
+ |
+#include <stdlib.h> |
+#include <string.h> |
+#include <unistd.h> |
+ |
+/* Init the network stack */ |
+int init_network(char *local_ip) |
+{ |
+ |
+ struct net_model m = net_base; |
+ |
+ net_setudpip(m, local_ip, "255.255.255.255"); |
+ |
+ if (net_init(&m) != 1) { |
+ cprintf("Network: Init Error.\n"); |
+ return -1; |
+ } |
+ |
+ return 0; |
+ |
+} |
+ |
+int main(int argc, char **argv) |
+{ |
+ UDP_ADDR target, local; |
+ char local_ip[20], target_ip[20], buff[10]; |
+ int socket, i; |
+ IP_ADDR bindlist[5]; |
+ |
+ strcpy(local_ip, "192.168.1.10"); |
+ strcpy(target_ip, "192.168.1.1"); |
+ |
+ if (init_network(local_ip)) exit(1); |
+ |
+ /* local IP string to addr */ |
+ ip_str2addr(local_ip,&(local.s_addr)); |
+ /* set the source port */ |
+ local.s_port = 100; |
+ |
+ /* target IP string to addr */ |
+ ip_str2addr(target_ip,&(bindlist[0])); |
+ memset(&(bindlist[1]), 0, sizeof(IP_ADDR)); |
+ /* bind */ |
+ socket = udp_bind(&local, NULL); |
+ |
+ /* target IP string to addr */ |
+ ip_str2addr(target_ip,&(target.s_addr)); |
+ /* target port */ |
+ target.s_port = 100; |
+ |
+ for (i = 0; i < 5; i++) { |
+ strcpy(buff, "qwerty\n"); |
+ cprintf("Send packet: %s\n", buff); |
+ udp_sendto(socket, buff, strlen(buff), &target); |
+ sleep(1); |
+ } |
+ |
+ cprintf("The End.\n"); |
+ |
+ exit(1); |
+ |
+ return 0; |
+} |
Index: xen/network/initfile.c |
=================================================================== |
--- xen/network/initfile.c (nonexistent) |
+++ xen/network/initfile.c (revision 1684) |
@@ -0,0 +1,162 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
+ * |
+ * Authors : |
+ * Mauro Marinoni <mauro.marinoni@unipv.it> |
+ * Tullio Facchinetti <tullio.facchinetti@unipv.it> |
+ * (see authors.txt for full list of hartik's authors) |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://hartik.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ */ |
+ |
+ |
+#include <kernel/kern.h> |
+ |
+#include "edf/edf/edf.h" |
+#include "cbs/cbs/cbs.h" |
+#include "rr/rr/rr.h" |
+#include "dummy/dummy/dummy.h" |
+#include "intdrive/intdrive/intdrive.h" |
+ |
+#include "sem/sem/sem.h" |
+#include "hartport/hartport/hartport.h" |
+ |
+#include <drivers/shark_linuxc26.h> |
+#include <drivers/shark_pci26.h> |
+#include <drivers/shark_input26.h> |
+#include <drivers/shark_keyb26.h> |
+ |
+/*+ sysyem tick in us +*/ |
+#define TICK 0 |
+ |
+/*+ RR tick in us +*/ |
+#define RRTICK 10000 |
+ |
+/*+ Interrupt Server +*/ |
+#define INTDRIVE_Q 1000 |
+#define INTDRIVE_U 0.1*MAX_BANDWIDTH |
+#define INTDRIVE_FLAG 0 |
+ |
+void call_shutdown_task(void *arg); |
+int device_drivers_init(); |
+int device_drivers_close(); |
+void set_shutdown_task(); |
+TASK shutdown_task_body(void *arg); |
+ |
+PID shutdown_task_PID = 1; |
+ |
+TIME __kernel_register_levels__(void *arg) |
+{ |
+ struct multiboot_info *mb = (struct multiboot_info *)arg; |
+ LEVEL EDF_level; |
+ |
+ INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG); |
+ EDF_level = EDF_register_level(EDF_ENABLE_ALL); |
+ CBS_register_level(CBS_ENABLE_ALL, EDF_level); |
+ RR_register_level(RRTICK, RR_MAIN_YES, mb); |
+ dummy_register_level(); |
+ |
+ SEM_register_module(); |
+ |
+ return TICK; |
+} |
+ |
+int device_drivers_close() { |
+ |
+ KEYB26_close(); |
+ INPUT26_close(); |
+ |
+ return 0; |
+ |
+} |
+ |
+int device_drivers_init() { |
+ |
+ KEYB_PARMS kparms = BASE_KEYB; |
+ |
+ LINUXC26_register_module(TRUE); |
+ PCI26_init(); |
+ INPUT26_init(); |
+ |
+ /*keyb_def_map(kparms, KEYMAP_IT);*/ |
+ keyb_def_ctrlC(kparms, NULL); |
+ KEYB26_init(&kparms); |
+ |
+ return 0; |
+} |
+ |
+TASK shutdown_task_body(void *arg) { |
+ |
+ device_drivers_close(); |
+ sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
+ return NULL; |
+} |
+ |
+#define SHUTDOWN_TIMEOUT_SEC 3 |
+ |
+void set_shutdown_task() { |
+ |
+ NRT_TASK_MODEL nrt; |
+ |
+ nrt_task_default_model(nrt); |
+ nrt_task_def_system(nrt); |
+ |
+ shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
+ if (shutdown_task_PID == NIL) { |
+ sys_shutdown_message("Error: Cannot create shutdown task\n"); |
+ exit(1); |
+ } |
+ |
+} |
+ |
+void call_shutdown_task(void *arg) { |
+ |
+ struct timespec t; |
+ |
+ sys_gettime(&t); |
+ t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
+ |
+ /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
+ kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
+ |
+ task_activate(shutdown_task_PID); |
+} |
+ |
+TASK __init__(void *arg) |
+{ |
+ struct multiboot_info *mb = (struct multiboot_info *)arg; |
+ |
+ HARTPORT_init(); |
+ |
+ set_shutdown_task(); |
+ |
+ device_drivers_init(); |
+ |
+ sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
+ |
+ __call_main__(mb); |
+ |
+ return (void *)0; |
+} |
Index: xen/network/talk.c |
=================================================================== |
--- xen/network/talk.c (nonexistent) |
+++ xen/network/talk.c (revision 1684) |
@@ -0,0 +1,217 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * (see the web pages for full authors list) |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ */ |
+ |
+/* |
+ * Copyright (C) 2000 Luca Abeni, Paolo Gai |
+ * |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ * |
+ * CVS : $Id: aster1.c,v 1.1 2002/10/28 08:13:37 pj Exp |
+ |
+ This is the talkdx.c Hartik's example. |
+ |
+ File: Talk.C |
+ Revision: 1.00 |
+ Author: Luca Abeni |
+ |
+ |
+ Simple Netlib demo: nothing of seriously real-time, only another Unix |
+ Talk clone. |
+ Read it to see how the UDP/IP layers of the networ library work. |
+ |
+*/ |
+ |
+#include <kernel/kern.h> |
+#include <string.h> |
+ |
+#include <drivers/crtwin.h> |
+#include <drivers/shark_keyb26.h> |
+ |
+#include <drivers/udpip.h> |
+ |
+ |
+WIN dbg; |
+BYTE esc = FALSE; |
+ |
+char talk_myipaddr[20]; |
+char talk_toipaddr[20]; |
+ |
+/* |
+ This non real-time task reads UDP packets from the network and writes |
+ them in a window |
+*/ |
+TASK scrittore(void) |
+{ |
+ char str[2000]; |
+ UDP_ADDR from, local; |
+ WIN displ; |
+ int s,n; |
+ |
+ /* Connect on the local port #100 */ |
+ local.s_port = 100; |
+ s = udp_bind(&local, NULL); |
+ |
+ /* Open the window */ |
+ win_init(&displ,0,0,79,6); |
+ win_frame(&displ,BLACK,WHITE,"Remote",2); |
+ |
+ while (1) { |
+ /* Clear the buffer for receiving the packet...*/ |
+ memset(str, 0, 1999); |
+ /*...and receive the packet (block until a packet arrives */ |
+ n = udp_recvfrom(s, str, &from); |
+ win_puts(&displ, str); |
+ } |
+} |
+ |
+/* |
+ This non real-time task reads strings from the keyoard and sends them |
+ to the remote host |
+*/ |
+TASK write(void) |
+{ |
+ WIN wr; |
+ UDP_ADDR to,local; |
+ char str[80],tmp[5],ch; |
+ int s; |
+ IP_ADDR bindlist[5]; |
+ |
+ win_init(&wr,0,7,79,6); |
+ win_frame(&wr,BLACK,WHITE,"Local",2); |
+ |
+ /* Create a socket for transitting */ |
+ ip_str2addr(talk_myipaddr,&(local.s_addr)); |
+ local.s_port = 101; |
+ |
+ /* |
+ If we want the address of the remote host in the ARP table before |
+ begginning the transmission (to eliminate a possible source of |
+ unpredictability), we can use the bindlist, otherwise we set the |
+ second parameter of udp_bind to NULL |
+ */ |
+ ip_str2addr(talk_toipaddr,&(bindlist[0])); |
+ memset(&(bindlist[1]), 0, sizeof(IP_ADDR)); |
+ s = udp_bind(&local, /*bindlist*/NULL); |
+ |
+ ip_str2addr(talk_toipaddr,&(to.s_addr)); |
+ to.s_port = 100; |
+ sprintf(str,"Local IP address %d.%d.%d.%d\n", local.s_addr.ad[0], |
+ local.s_addr.ad[1], local.s_addr.ad[2], |
+ local.s_addr.ad[3]); |
+ win_puts(&dbg,str); |
+ sprintf(str,"Talk to %d.%d.%d.%d ",to.s_addr.ad[0],to.s_addr.ad[1], |
+ to.s_addr.ad[2],to.s_addr.ad[3]); |
+ win_puts(&dbg,str); |
+ while (1) { |
+ /* Get the string...*/ |
+ while((ch = keyb_getch(BLOCK)) != 13) { |
+ sprintf(tmp,"%c",ch); |
+ strcat(str,tmp); |
+ win_puts(&wr,tmp); |
+ } |
+ strcat(str,"\n"); |
+ win_puts(&wr,"\n"); |
+ /*...and send it!!! */ |
+ udp_sendto(s,str,strlen(str)+2,&to); |
+ str[0] = 0; |
+ } |
+} |
+ |
+/* This function is called when the user presses CTRL-C (stops the systems) */ |
+void esci(KEY_EVT *k) |
+{ |
+ esc = TRUE; |
+ exit(1); |
+} |
+ |
+int main(int argc, char **argv) |
+{ |
+ KEY_EVT k; |
+ |
+ struct net_model m = net_base; |
+ |
+ NRT_TASK_MODEL m_nrt; |
+ |
+ k.flag = CNTL_BIT; |
+ k.scan = KEY_C; |
+ k.ascii = 'c'; |
+ k.status = KEY_PRESSED; |
+ keyb_hook(k,esci,FALSE); |
+ k.flag = CNTR_BIT; |
+ k.scan = KEY_C; |
+ k.ascii = 'c'; |
+ k.status = KEY_PRESSED; |
+ keyb_hook(k,esci,FALSE); |
+ |
+ clear(); |
+ cprintf(" S.Ha.R.K. Talk! Ver. 1.10\n"); |
+ |
+ if (argc != 3) { |
+ cprintf("S.Ha.R.K. Talk usage: talk fromIP toIP\n"); |
+ return 0; |
+ } |
+ |
+ strcpy(talk_myipaddr, argv[1]); |
+ strcpy(talk_toipaddr, argv[2]); |
+ |
+ /* We want a task for TX mutual exclusion */ |
+ net_setmode(m, TXTASK); |
+ /* We use UDP/IP stack */ |
+ net_setudpip(m, talk_myipaddr, "255.255.255.255"); |
+ /* OK: let's start the NetLib! */ |
+ if (net_init(&m) == 1) { |
+ cprintf("Net Init OK...\n"); |
+ } else { |
+ cprintf("Net Init Failed...\n"); |
+ exit(300); |
+ } |
+ |
+ |
+ //dump_irq(); |
+ |
+ cprintf("\n\n\n\tPress ENTER\n"); |
+ while (!esc) { |
+ keyb_getcode(&k,BLOCK); |
+ if (k.ascii == 13) esc = TRUE; |
+ } |
+ |
+ esc = FALSE; |
+ clear(); |
+ win_init(&dbg,0,20,60,3); |
+ win_frame(&dbg,BLACK,WHITE,"Debug",2); |
+ |
+ /* Start the sender and receiver tasks...*/ |
+ nrt_task_default_model(m_nrt); |
+ task_activate(task_create("aaa",scrittore,&m_nrt,NULL)); |
+ task_activate(task_create("bbb",write,&m_nrt,NULL)); |
+ |
+ return 0; |
+} |
Index: xen/newtrace/udp/udptrace.c |
=================================================================== |
--- xen/newtrace/udp/udptrace.c (nonexistent) |
+++ xen/newtrace/udp/udptrace.c (revision 1684) |
@@ -0,0 +1,141 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Giacomo Guidi <giacomo@gandalf.sssup.it> |
+ * Tullio Facchinetti <tullio.facchinetti@unipv.it> |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ * http://robot.unipv.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <kernel/kern.h> |
+#include <FTrace_chunk.h> |
+#include <FTrace_udp.h> |
+#include <tracer.h> |
+ |
+extern unsigned int clk_per_msec; |
+ |
+int main(int argc, char **argv) |
+{ |
+ |
+ long long i; |
+ |
+ int a,b,c; |
+ struct timespec start,end,diff; |
+ SYS_FLAGS f; |
+ |
+ /** |
+ * Create 3 chunks for storing the tracer events. |
+ * Explanation of flags: |
+ * FTRACE_CHUNK_FLAG_FREE : the chunk is free to use |
+ * FTRACE_CHUNK_FLAG_CYC : the chunk stores events in a cyclical way. |
+ * When the chunk is full, |
+ * it will continue from the head. |
+ * FTRACE_CHUNK_FLAG_JTN : when the chunk is full, |
+ * it jumps to the next chunk. |
+ */ |
+ a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
+ b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
+ c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
+ |
+ /** |
+ * Link the 3 chunks together. |
+ * It is important to link before you can jump from one to another. |
+ */ |
+ FTrace_chunk_link(a,b); |
+ FTrace_chunk_link(b,c); |
+ |
+ /** Select the first chunk for saving the events. */ |
+ FTrace_actual_chunk_select(a); |
+ |
+ kern_gettime(&start); |
+ |
+ /** Start the tracer. */ |
+ FTrace_enable(); |
+ |
+ /** Enable filtering for timer related events. */ |
+ FTrace_set_filter(FTrace_filter_timer, 1); |
+ |
+ TRACER_LOGEVENT(FTrace_EVT_trace_start,proc_table[exec_shadow].context,clk_per_msec); |
+ |
+ for (i=0;i<10;i++) |
+ if (proc_table[i].context != 0) TRACER_LOGEVENT(FTrace_EVT_id, |
+ (unsigned short int)proc_table[i].context,i); |
+ |
+ for (i=0;i<1000000000;i++); |
+ |
+ /** Enable filtering for timer related events. */ |
+ FTrace_set_filter(FTrace_filter_timer, 0); |
+ |
+ /** Change the chunk where the events are stored. */ |
+ TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0); |
+ |
+ f = kern_fsave(); |
+ __asm__("cpuid":::"eax","ebx","ecx","edx"); |
+ FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,1000,0); |
+ FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,2000,0); |
+ FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,3000,0); |
+ FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,4000,0); |
+ FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,5000,0); |
+ __asm__("cpuid":::"eax","ebx","ecx","edx"); |
+ kern_frestore(f); |
+ |
+ TRACER_LOGEVENT(FTrace_EVT_ipoint,6000,0); |
+ |
+ for (i=0;i<1000000000;i++); |
+ |
+ /** Store a TFrace stop event. */ |
+ TRACER_LOGEVENT(FTrace_EVT_trace_stop,0,0); |
+ |
+ /** Stop the tracer. */ |
+ FTrace_disable(); |
+ kern_gettime(&end); |
+ |
+ SUBTIMESPEC(&end,&start,&diff); |
+ |
+ cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000); |
+ |
+ /** Initialize the network for remotely saving the trace. */ |
+ FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1"); |
+ |
+ /** |
+ * You may want to save the events to disk. In that case, simply change |
+ * the network initialization instruction with the following line: |
+ * |
+ * FTrace_init_disk_writer("trace.dat", 0, NULL, NULL); |
+ * |
+ */ |
+ |
+ /** Save the chunk. */ |
+ FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
+ FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
+ |
+ return 0; |
+ |
+} |
Index: xen/newtrace/udp/initfile.c |
=================================================================== |
--- xen/newtrace/udp/initfile.c (nonexistent) |
+++ xen/newtrace/udp/initfile.c (revision 1684) |
@@ -0,0 +1,162 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
+ * |
+ * Authors : |
+ * Mauro Marinoni <mauro.marinoni@unipv.it> |
+ * Tullio Facchinetti <tullio.facchinetti@unipv.it> |
+ * (see authors.txt for full list of hartik's authors) |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://hartik.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ */ |
+ |
+ |
+#include <kernel/kern.h> |
+ |
+#include "edf/edf/edf.h" |
+#include "cbs/cbs/cbs.h" |
+#include "rr/rr/rr.h" |
+#include "dummy/dummy/dummy.h" |
+#include "intdrive/intdrive/intdrive.h" |
+ |
+#include "sem/sem/sem.h" |
+#include "hartport/hartport/hartport.h" |
+ |
+#include <drivers/shark_linuxc26.h> |
+#include <drivers/shark_pci26.h> |
+#include <drivers/shark_input26.h> |
+#include <drivers/shark_keyb26.h> |
+ |
+/*+ sysyem tick in us +*/ |
+#define TICK 0 |
+ |
+/*+ RR tick in us +*/ |
+#define RRTICK 10000 |
+ |
+/*+ Interrupt Server +*/ |
+#define INTDRIVE_Q 1000 |
+#define INTDRIVE_U 0.1*MAX_BANDWIDTH |
+#define INTDRIVE_FLAG 0 |
+ |
+void call_shutdown_task(void *arg); |
+int device_drivers_init(); |
+int device_drivers_close(); |
+void set_shutdown_task(); |
+TASK shutdown_task_body(void *arg); |
+ |
+PID shutdown_task_PID = 1; |
+ |
+TIME __kernel_register_levels__(void *arg) |
+{ |
+ struct multiboot_info *mb = (struct multiboot_info *)arg; |
+ LEVEL EDF_level; |
+ |
+ INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG); |
+ EDF_level = EDF_register_level(EDF_ENABLE_ALL); |
+ CBS_register_level(CBS_ENABLE_ALL, EDF_level); |
+ RR_register_level(RRTICK, RR_MAIN_YES, mb); |
+ dummy_register_level(); |
+ |
+ SEM_register_module(); |
+ |
+ return TICK; |
+} |
+ |
+int device_drivers_close() { |
+ |
+ KEYB26_close(); |
+ INPUT26_close(); |
+ |
+ return 0; |
+ |
+} |
+ |
+int device_drivers_init() { |
+ |
+ KEYB_PARMS kparms = BASE_KEYB; |
+ |
+ LINUXC26_register_module(TRUE); |
+ PCI26_init(); |
+ //INPUT26_init(); |
+ |
+ /*keyb_def_map(kparms, KEYMAP_IT);*/ |
+ keyb_def_ctrlC(kparms, NULL); |
+ KEYB26_init(&kparms); |
+ |
+ return 0; |
+} |
+ |
+TASK shutdown_task_body(void *arg) { |
+ |
+ device_drivers_close(); |
+ sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
+ return NULL; |
+} |
+ |
+#define SHUTDOWN_TIMEOUT_SEC 3 |
+ |
+void set_shutdown_task() { |
+ |
+ NRT_TASK_MODEL nrt; |
+ |
+ nrt_task_default_model(nrt); |
+ nrt_task_def_system(nrt); |
+ |
+ shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
+ if (shutdown_task_PID == NIL) { |
+ sys_shutdown_message("Error: Cannot create shutdown task\n"); |
+ exit(1); |
+ } |
+ |
+} |
+ |
+void call_shutdown_task(void *arg) { |
+ |
+ struct timespec t; |
+ |
+ sys_gettime(&t); |
+ t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
+ |
+ /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
+ kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
+ |
+ task_activate(shutdown_task_PID); |
+} |
+ |
+TASK __init__(void *arg) |
+{ |
+ struct multiboot_info *mb = (struct multiboot_info *)arg; |
+ |
+ HARTPORT_init(); |
+ |
+ set_shutdown_task(); |
+ |
+ device_drivers_init(); |
+ |
+ sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
+ |
+ __call_main__(mb); |
+ |
+ return (void *)0; |
+} |
Index: xen/newtrace/udp/makefile |
=================================================================== |
--- xen/newtrace/udp/makefile (nonexistent) |
+++ xen/newtrace/udp/makefile (revision 1684) |
@@ -0,0 +1,16 @@ |
+# |
+# |
+# |
+ |
+ifndef BASE |
+BASE=../../.. |
+endif |
+include $(BASE)/config/config.mk |
+ |
+PROGS = udptrace |
+ |
+include $(BASE)/config/example.mk |
+ |
+udptrace: |
+ make -f $(SUBMAKE) BASE=$(BASE) APP=udptrace INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __NET__" |
+ |
Index: xen/newtrace/instr/instr.c |
=================================================================== |
--- xen/newtrace/instr/instr.c (nonexistent) |
+++ xen/newtrace/instr/instr.c (revision 1684) |
@@ -0,0 +1,168 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Giacomo Guidi <giacomo@gandalf.sssup.it> |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+/* The tracer instrumentation ideas come from the York PWCET analisys tool |
+ * |
+ * Real-Time System Group |
+ * University of York |
+ * |
+ */ |
+ |
+#include <kernel/kern.h> |
+#include <time.h> |
+#include <tracer.h> |
+ |
+#define PWCET_Automatic_Ipoint(a) TRACER_LOGEVENT(FTrace_EVT_ipoint,(a),0); |
+ |
+extern int instrumented_function(); |
+ |
+TASK ext_call(void) |
+{ |
+ |
+ while(1) { |
+ |
+ instrumented_function(); |
+ |
+ task_testcancel(); |
+ task_endcycle(); |
+ |
+ } |
+ |
+ return 0; |
+ |
+} |
+ |
+#define TASKMAX 4 |
+#define TASKDELAY 1000000 |
+#define TASKDELAY_DELTA 100000 |
+ |
+int exec_code() { |
+ |
+ int num; |
+ struct timespec t; |
+ |
+ HARD_TASK_MODEL m; |
+ PID p; |
+ |
+ clear(); |
+ |
+ cprintf("Start"); |
+ |
+ hard_task_default_model(m); |
+ hard_task_def_mit(m,200000 + rand() % 100000); |
+ hard_task_def_wcet(m,40000); |
+ hard_task_def_group(m,2); |
+ |
+ num = 0; |
+ |
+ while(num < TASKMAX) { |
+ |
+ cprintf("."); |
+ |
+ p = task_create("Instr",ext_call,&m,NULL); |
+ if (p == -1) { |
+ sys_shutdown_message("Could not create task <instr> ..."); |
+ exit(1); |
+ } |
+ |
+ num++; |
+ task_activate(p); |
+ |
+ usleep(TASKDELAY + rand() % TASKDELAY_DELTA); |
+ |
+ } |
+ |
+ do { |
+ sys_gettime(&t); |
+ } while (t.tv_sec < 12); |
+ |
+ cprintf("End\n"); |
+ |
+ return 0; |
+ |
+} |
+ |
+extern unsigned int clk_per_msec; |
+ |
+int main(int argc, char **argv) |
+{ |
+ |
+ int a,b,c,i; |
+ struct timespec t,start,end,diff; |
+ |
+ srand(sys_gettime(NULL)); |
+ |
+ a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
+ b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
+ c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
+ |
+ FTrace_chunk_link(a,b); |
+ FTrace_chunk_link(b,c); |
+ |
+ FTrace_actual_chunk_select(a); |
+ |
+ kern_gettime(&start); |
+ FTrace_enable(); |
+ |
+ TRACER_LOGEVENT(FTrace_EVT_trace_start,proc_table[exec_shadow].context,clk_per_msec); |
+ |
+ for (i=0;i<10;i++) |
+ if (proc_table[i].context != 0) TRACER_LOGEVENT(FTrace_EVT_id, |
+ (unsigned short int)proc_table[i].context,i); |
+ |
+ exec_code(); |
+ |
+ TRACER_LOGEVENT(FTrace_EVT_trace_stop,0,0); |
+ |
+ FTrace_disable(); |
+ kern_gettime(&end); |
+ |
+ SUBTIMESPEC(&end,&start,&diff); |
+ |
+ printf_xy(1,21,WHITE,"Logged Time %d s %d us",(int)diff.tv_sec,(int)diff.tv_nsec/1000); |
+ |
+ group_kill(2); |
+ |
+ do { |
+ sys_gettime(&t); |
+ } while (t.tv_sec < 12); |
+ |
+ FTrace_OSD_init_udp(1, "192.168.0.15", "192.168.0.12"); |
+ |
+ FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
+ |
+ return 0; |
+ |
+} |
+ |
Index: xen/newtrace/instr/bezier.c |
=================================================================== |
--- xen/newtrace/instr/bezier.c (nonexistent) |
+++ xen/newtrace/instr/bezier.c (revision 1684) |
@@ -0,0 +1,127 @@ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <kernel/kern.h> |
+#include <tracer.h> |
+ |
+#define PWCET_Automatic_Ipoint(a) TRACER_LOGEVENT(FTrace_EVT_ipoint,(a),0); |
+ |
+/* here are the bezier curves defined |
+format: |
+{startpoint, endpoint, controlpoint1, controlpoint} |
+. |
+. |
+. */ |
+int curveno = 20; |
+int data[20][4][2] = { |
+ {{123,321},{ 23,432},{345,120},{123, 98}}, |
+ {{567, 31},{ 23, 24},{ 35,421},{123,398}}, |
+ {{ 0, 21},{623,532},{145,323},{153, 68}}, |
+ {{253,321},{ 23,432},{745,525},{423,198}}, |
+ {{123,456},{ 23,482},{ 0,123},{123,128}}, |
+ {{322, 21},{223,232},{ 45,224},{123,98}}, |
+ {{423, 32},{123,332},{144,329},{123,98}}, |
+ {{276, 35},{ 23,492},{476,423},{123,98}}, |
+ {{783,121},{723,139},{ 78,528},{123,98}}, |
+ {{723,221},{623, 98},{734,683},{123,98}}, |
+ {{ 60,421},{523,132},{364,753},{123,98}}, |
+ {{100,521},{423,432},{633,623},{123,98}}, |
+ {{ 23,371},{323,599},{343,533},{123,98}}, |
+ {{123,123},{123, 0},{343,403},{123,98}}, |
+ {{253,321},{490, 32},{347,393},{123,98}}, |
+ {{ 68,321},{260,272},{674,283},{123,98}}, |
+ {{500,321},{245,373},{ 98,173},{123,98}}, |
+ {{423,321},{198,532},{306, 63},{123,98}}, |
+ {{197,321},{203,432},{307,443},{123,98}}, |
+ {{143,321},{293,132},{334,393},{123,98}} |
+}; |
+#define STEPWIDTH 0.01 /* draws 1/STEPWIDTH +1 points between SP and EP */ |
+#define XSIZE 800 |
+#define YSIZE 600 |
+ |
+char screen[YSIZE][XSIZE]; |
+int xco[4],yco[4]; |
+ |
+int init() |
+{ |
+ int y,x; |
+ |
+ /*initialize screen*/ |
+ for (x = 0;x < XSIZE;x++) { |
+ for (y = 0;y < YSIZE;y++) { |
+ screen[y][x] = 255; /*white*/ |
+ } |
+ } |
+ |
+ return 0; |
+ |
+} |
+ |
+void rand_init() |
+{ |
+ int i,j,x,y; |
+ for (i=0;i<20;i++) |
+ for (j=0;j<4;j++) { |
+ x=rand()%800; |
+ y=rand()%600; |
+ data[i][j][0]=x; |
+ data[i][j][1]=y; |
+ } |
+} |
+ |
+int bezier() |
+{ |
+ |
+ int i,y,x; |
+ float k; |
+ |
+ init(); |
+ |
+ for (i = 0;i < curveno;i++) { |
+ xco[3] = data[i][0][0]; |
+ yco[3] = data[i][0][1]; |
+ xco[2] = 3*(data[i][2][0] - data[i][0][0]); |
+ yco[2] = 3*(data[i][2][1] - data[i][0][1]); |
+ xco[1] = 3*(data[i][3][0] - data[i][2][0]) - xco[2]; |
+ yco[1] = 3*(data[i][3][1] - data[i][2][1]) - yco[2]; |
+ xco[0] = data[i][1][0] - data[i][0][0] - xco[2]- xco[1]; |
+ yco[0] = data[i][1][1] - data[i][0][1] - yco[2]- yco[1]; |
+ |
+ /*scan curve for t = 0 to t = 1 with STEPWIDTH*/ |
+ for (k = 0;k <=1;k+=STEPWIDTH) { /* PAN_FIXED_LOOP PAN_VARPATH */ |
+ x = (int)(((float)xco[0]*k*k*k)+((float)xco[1]*k*k)+((float)xco[2]*k)+(float)xco[3]); |
+ y = (int)(((float)yco[0]*k*k*k)+((float)yco[1]*k*k)+((float)yco[2]*k)+(float)yco[3]); |
+ if ((x < XSIZE)&&(x > 0)&&(y < YSIZE)&&(y > 0)) { |
+ /*write dot to screen*/ |
+ screen[y][x] = 0; /*black*/ |
+ } |
+ } |
+ } |
+ |
+ return 0; |
+} |
+ |
+int instrumented_function() { |
+ |
+ rand_init(); |
+ |
+ bezier(); |
+ |
+ return 0; |
+} |
+ |
Index: xen/newtrace/instr/bezier_i.c |
=================================================================== |
--- xen/newtrace/instr/bezier_i.c (nonexistent) |
+++ xen/newtrace/instr/bezier_i.c (revision 1684) |
@@ -0,0 +1,137 @@ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <kernel/kern.h> |
+#include <tracer.h> |
+ |
+#define PWCET_Automatic_Ipoint(a) TRACER_LOGEVENT(FTrace_EVT_ipoint,(a),0); |
+ |
+/* here are the bezier curves defined |
+format: |
+{startpoint, endpoint, controlpoint1, controlpoint} |
+. |
+. |
+. */ |
+int curveno = 20; |
+int data[20][4][2] = { |
+ {{123,321},{ 23,432},{345,120},{123, 98}}, |
+ {{567, 31},{ 23, 24},{ 35,421},{123,398}}, |
+ {{ 0, 21},{623,532},{145,323},{153, 68}}, |
+ {{253,321},{ 23,432},{745,525},{423,198}}, |
+ {{123,456},{ 23,482},{ 0,123},{123,128}}, |
+ {{322, 21},{223,232},{ 45,224},{123,98}}, |
+ {{423, 32},{123,332},{144,329},{123,98}}, |
+ {{276, 35},{ 23,492},{476,423},{123,98}}, |
+ {{783,121},{723,139},{ 78,528},{123,98}}, |
+ {{723,221},{623, 98},{734,683},{123,98}}, |
+ {{ 60,421},{523,132},{364,753},{123,98}}, |
+ {{100,521},{423,432},{633,623},{123,98}}, |
+ {{ 23,371},{323,599},{343,533},{123,98}}, |
+ {{123,123},{123, 0},{343,403},{123,98}}, |
+ {{253,321},{490, 32},{347,393},{123,98}}, |
+ {{ 68,321},{260,272},{674,283},{123,98}}, |
+ {{500,321},{245,373},{ 98,173},{123,98}}, |
+ {{423,321},{198,532},{306, 63},{123,98}}, |
+ {{197,321},{203,432},{307,443},{123,98}}, |
+ {{143,321},{293,132},{334,393},{123,98}} |
+}; |
+#define STEPWIDTH 0.01 /* draws 1/STEPWIDTH +1 points between SP and EP */ |
+#define XSIZE 800 |
+#define YSIZE 600 |
+ |
+char screen[YSIZE][XSIZE]; |
+int xco[4],yco[4]; |
+ |
+void init() |
+{ /*FB1*/PWCET_Automatic_Ipoint( 3157); /*FB2*/{ |
+ int y,x; |
+ |
+ |
+ { /*forx1*/for (x = 0; x < XSIZE;x++) { /*forx2*/PWCET_Automatic_Ipoint( 3158); /*forx3*/{ |
+ { /*forx1*/for (y = 0;y < YSIZE;y++) { /*forx2*/PWCET_Automatic_Ipoint( 3159); /*forx3*/{ |
+ screen[y][x] = 255; |
+ } } /*forx4*/PWCET_Automatic_Ipoint( 3160); /*forx5*/ } /*forx6*/ |
+ } } /*forx4*/PWCET_Automatic_Ipoint( 3161); /*forx5*/ } /*forx6*/ |
+ |
+}PWCET_Automatic_Ipoint( 3162); /*FB3*/} /*FB4*/ |
+ |
+void rand_init() |
+{ /*FB1*/PWCET_Automatic_Ipoint( 33519); /*FB2*/{ |
+ int i,j,x,y; |
+ |
+ |
+ |
+ { /*forx1*/for (i=0;i<20;i++) |
+ { /*forx1*/ { /*forx2*/PWCET_Automatic_Ipoint( 33520); /*forx3*/for (j=0;j<4;j++) { /*forx2*/PWCET_Automatic_Ipoint( 33521); /*forx3*/{ |
+ x=rand()%XSIZE; |
+ y=rand()%YSIZE; |
+ data[i][j][0]=x; |
+ data[i][j][1]=y; |
+ } } /*forx4*/PWCET_Automatic_Ipoint( 33522); /*forx5*/ } /*forx6*/ } /*forx4*/PWCET_Automatic_Ipoint( 33523); /*forx5*/ } /*forx6*/ |
+ |
+ |
+}PWCET_Automatic_Ipoint( 33524); /*FB3*/} /*FB4*/ |
+ |
+void pepe(){ /*FB1*/PWCET_Automatic_Ipoint( 64662); /*FB2*/{ |
+ int a; |
+ |
+ a=a+2; |
+ }PWCET_Automatic_Ipoint( 64663); /*FB3*/} /*FB4*/ |
+ |
+int bezier() |
+{ /*FB1*/PWCET_Automatic_Ipoint( 23955); /*FB2*/{ |
+ int i,y,x; |
+ float k; |
+ init(); |
+ |
+ { /*forx1*/for (i = 0;i < curveno;i++) { /*forx2*/PWCET_Automatic_Ipoint( 23956); /*forx3*/{ |
+ xco[3] = data[i][0][0]; |
+ yco[3] = data[i][0][1]; |
+ xco[2] = 3*(data[i][2][0] - data[i][0][0]); |
+ yco[2] = 3*(data[i][2][1] - data[i][0][1]); |
+ xco[1] = 3*(data[i][3][0] - data[i][2][0]) - xco[2]; |
+ yco[1] = 3*(data[i][3][1] - data[i][2][1]) - yco[2]; |
+ xco[0] = data[i][1][0] - data[i][0][0] - xco[2]- xco[1]; |
+ yco[0] = data[i][1][1] - data[i][0][1] - yco[2]- yco[1]; |
+ |
+ |
+ { /*forx1*/for (k = 0;k <=1;k+=0.01) { /*forx2*/PWCET_Automatic_Ipoint( 23957); /*forx3*/{ |
+ x = (int)(((float)xco[0]*k*k*k)+((float)xco[1]*k*k)+((float)xco[2]*k)+(float)xco[3]); |
+ y = (int)(((float)yco[0]*k*k*k)+((float)yco[1]*k*k)+((float)yco[2]*k)+(float)yco[3]); |
+ if ((x < XSIZE)&&(x > 0)&&(y < YSIZE)&&(y > 0)) { /*if1*/ PWCET_Automatic_Ipoint( 23958); /*if2*/ { |
+ |
+ screen[y][x] = 0; |
+ } } /*if3*/ PWCET_Automatic_Ipoint( 23959); /*ifxxx2*/ |
+ } } /*forx4*/PWCET_Automatic_Ipoint( 23960); /*forx5*/ } /*forx6*/ |
+ } } /*forx4*/PWCET_Automatic_Ipoint( 23961); /*forx5*/ } /*forx6*/ |
+ if (1==0) { /*if1*/ PWCET_Automatic_Ipoint( 23962); /*if2*/ { |
+ k++; |
+ pepe(); |
+ } } /*if3*/ PWCET_Automatic_Ipoint( 23963); /*ifxxx2*/ |
+ |
+ |
+ { /*returnE1*/PWCET_Automatic_Ipoint( 23964); /*returnE2*/return 0; } /*returnE3*/ |
+}PWCET_Automatic_Ipoint( 23965); /*FB3*/} /*FB4*/ |
+ |
+ |
+int instrumented_function(){ /*FB1*/PWCET_Automatic_Ipoint( 18549); /*FB2*/{ |
+ |
+ rand_init(); |
+ bezier(); |
+ { /*returnE1*/PWCET_Automatic_Ipoint( 18550); /*returnE2*/return 0; } /*returnE3*/ |
+}PWCET_Automatic_Ipoint( 18551); /*FB3*/} /*FB4*/ |
Index: xen/newtrace/instr/initfile.c |
=================================================================== |
--- xen/newtrace/instr/initfile.c (nonexistent) |
+++ xen/newtrace/instr/initfile.c (revision 1684) |
@@ -0,0 +1,153 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
+ * |
+ * Authors : |
+ * Mauro Marinoni <mauro.marinoni@unipv.it> |
+ * Tullio Facchinetti <tullio.facchinetti@unipv.it> |
+ * (see authors.txt for full list of hartik's authors) |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://hartik.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ */ |
+ |
+ |
+#include <kernel/kern.h> |
+ |
+#include "edf/edf/edf.h" |
+#include "cbs/cbs/cbs.h" |
+#include "rr/rr/rr.h" |
+#include "dummy/dummy/dummy.h" |
+#include "intdrive/intdrive/intdrive.h" |
+ |
+#include "sem/sem/sem.h" |
+#include "hartport/hartport/hartport.h" |
+ |
+#include <drivers/shark_linuxc26.h> |
+#include <drivers/shark_pci26.h> |
+#include <drivers/shark_input26.h> |
+#include <drivers/shark_keyb26.h> |
+ |
+/*+ sysyem tick in us +*/ |
+#define TICK 0 |
+ |
+/*+ RR tick in us +*/ |
+#define RRTICK 10000 |
+ |
+/*+ Interrupt Server +*/ |
+#define INTDRIVE_Q 1000 |
+#define INTDRIVE_U 0.1*MAX_BANDWIDTH |
+#define INTDRIVE_FLAG 0 |
+ |
+void call_shutdown_task(void *arg); |
+int device_drivers_init(); |
+int device_drivers_close(); |
+void set_shutdown_task(); |
+TASK shutdown_task_body(void *arg); |
+ |
+PID shutdown_task_PID = 1; |
+ |
+TIME __kernel_register_levels__(void *arg) |
+{ |
+ struct multiboot_info *mb = (struct multiboot_info *)arg; |
+ LEVEL EDF_level; |
+ |
+ INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG); |
+ EDF_level = EDF_register_level(EDF_ENABLE_ALL); |
+ CBS_register_level(CBS_ENABLE_ALL, EDF_level); |
+ RR_register_level(RRTICK, RR_MAIN_YES, mb); |
+ dummy_register_level(); |
+ |
+ SEM_register_module(); |
+ |
+ return TICK; |
+} |
+ |
+int device_drivers_close() { |
+ |
+ return 0; |
+ |
+} |
+ |
+int device_drivers_init() { |
+ |
+ LINUXC26_register_module(TRUE); |
+ PCI26_init(); |
+ |
+ return 0; |
+} |
+ |
+TASK shutdown_task_body(void *arg) { |
+ |
+ device_drivers_close(); |
+ sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
+ |
+ return NULL; |
+} |
+ |
+#define SHUTDOWN_TIMEOUT_SEC 3 |
+ |
+void set_shutdown_task() { |
+ |
+ NRT_TASK_MODEL nrt; |
+ |
+ nrt_task_default_model(nrt); |
+ nrt_task_def_system(nrt); |
+ |
+ shutdown_task_PID = task_create("Shutdown Task", shutdown_task_body, &nrt, NULL); |
+ if (shutdown_task_PID == NIL) { |
+ sys_shutdown_message("Error: Cannot create shutdown task\n"); |
+ exit(1); |
+ } |
+ |
+} |
+ |
+void call_shutdown_task(void *arg) { |
+ |
+ struct timespec t; |
+ |
+ sys_gettime(&t); |
+ t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
+ |
+ /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
+ kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
+ |
+ task_activate(shutdown_task_PID); |
+} |
+ |
+TASK __init__(void *arg) |
+{ |
+ struct multiboot_info *mb = (struct multiboot_info *)arg; |
+ |
+ HARTPORT_init(); |
+ |
+ set_shutdown_task(); |
+ |
+ device_drivers_init(); |
+ |
+ sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
+ |
+ __call_main__(mb); |
+ |
+ return (void *)0; |
+} |
Index: xen/newtrace/instr/makefile |
=================================================================== |
--- xen/newtrace/instr/makefile (nonexistent) |
+++ xen/newtrace/instr/makefile (revision 1684) |
@@ -0,0 +1,17 @@ |
+# |
+# |
+# |
+ |
+ifndef BASE |
+BASE=../../.. |
+endif |
+include $(BASE)/config/config.mk |
+ |
+PROGS = instr |
+ |
+include $(BASE)/config/example.mk |
+ |
+instr: |
+ make -f $(SUBMAKE) BASE=$(BASE) APP=instr INIT= OTHEROBJS="initfile.o bezier.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __NET__" |
+ #make -f $(SUBMAKE) BASE=$(BASE) APP=instr INIT= OTHEROBJS="initfile.o bezier_i.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __NET__ |
+ |
Index: xen/newtrace/utils/udpdump.c |
=================================================================== |
--- xen/newtrace/utils/udpdump.c (nonexistent) |
+++ xen/newtrace/utils/udpdump.c (revision 1684) |
@@ -0,0 +1,151 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Giacomo Guidi <giacomo@gandalf.sssup.it> |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <netinet/in.h> |
+ |
+#include <sys/socket.h> |
+#include <netinet/in.h> |
+#include <arpa/inet.h> |
+#include <netdb.h> |
+#include <stdio.h> |
+#include <unistd.h>/* close() */ |
+#include <stdlib.h> |
+#include <signal.h> |
+#include <string.h> |
+ |
+#define SERVER_PORT 20000 |
+#define MAX_MSG 10000 |
+ |
+struct tracer_udp_header { |
+ char id[12]; |
+ unsigned int pkt_number; |
+ unsigned int events; |
+ unsigned int size; |
+}; |
+ |
+FILE *output_file; |
+ |
+int miss; |
+ |
+void close_and_exit() |
+{ |
+ |
+ printf("Closing...\n"); |
+ |
+ if (miss == 1) printf("Possible error receiving packets !\n"); |
+ |
+ fclose(output_file); |
+ |
+ exit(0); |
+ |
+} |
+ |
+int main(int argc, char *argv[]) |
+{ |
+ int sd, rc, n, cliLen,count; |
+ struct sockaddr_in cliAddr, servAddr; |
+ char msg[MAX_MSG]; |
+ |
+ struct tracer_udp_header *pkt_head = (struct tracer_udp_header *)(msg); |
+ |
+ if (argc < 2) { |
+ printf("%s: Enter the output file name [%s filename]\n",argv[0],argv[0]); |
+ exit(1); |
+ } |
+ |
+ // socket creation |
+ sd = socket(AF_INET, SOCK_DGRAM, 0); |
+ if(sd < 0) { |
+ printf("%s: cannot open socket \n",argv[0]); |
+ exit(1); |
+ } |
+ |
+ output_file = fopen(argv[1],"w+b"); |
+ if (output_file == NULL) { |
+ printf("%s: Cannot open the file\n",argv[0]); |
+ exit(1); |
+ } |
+ |
+ // bind local server port |
+ servAddr.sin_family = AF_INET; |
+ |
+ servAddr.sin_addr.s_addr = htonl(INADDR_ANY); |
+ servAddr.sin_port = htons(SERVER_PORT); |
+ |
+ rc = bind (sd, (struct sockaddr *)&servAddr,sizeof(servAddr)); |
+ if(rc < 0) { |
+ printf("%s: cannot bind port number %d \n", |
+ argv[0], SERVER_PORT); |
+ exit(1); |
+ } |
+ |
+ signal(SIGINT, close_and_exit); |
+ |
+ count = 1; |
+ miss = 0; |
+ |
+ while(1) { |
+ |
+ printf("Wait packet...\n"); |
+ |
+ // receive message |
+ cliLen = sizeof(cliAddr); |
+ n = recvfrom(sd, msg, MAX_MSG, 0,(struct sockaddr *)&cliAddr, &cliLen); |
+ |
+ if (strncmp(pkt_head->id,"TRACER",6)) continue; |
+ |
+ printf("Received %d, length %d(%d), %d tracer events.\n", |
+ pkt_head->pkt_number, n, pkt_head->size, pkt_head->events); |
+ |
+ if (pkt_head->pkt_number != count) { |
+ printf("Miss Packet !!!\n"); |
+ miss = 1; |
+ } |
+ |
+ if (n > 0) { |
+ |
+ count++; |
+ |
+ fwrite((void *)(msg+sizeof(struct tracer_udp_header)),n-sizeof(struct tracer_udp_header),1,output_file); |
+ |
+ } |
+ |
+ } |
+ |
+ fclose(output_file); |
+ |
+ return 0; |
+ |
+} |
+ |
Index: xen/newtrace/utils/extract.c |
=================================================================== |
--- xen/newtrace/utils/extract.c (nonexistent) |
+++ xen/newtrace/utils/extract.c (revision 1684) |
@@ -0,0 +1,1131 @@ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+#include <stdio.h> |
+#include <stdlib.h> |
+#include <math.h> |
+#include <unistd.h> |
+#include <string.h> |
+ |
+#define MAXCONTEXT 100 |
+#define MAXJOB 300000 |
+ |
+#define INT_CTX 1 |
+#define INT_PID 9999 |
+#define PID_NO_DEF -1 |
+#define SERVER_NO_DEF -1 |
+ |
+#define BACKGROUND 0 |
+#define PERIODICAL 1 |
+#define INTERRUPT 2 |
+ |
+#define DRAW_NUM 1000 |
+ |
+#define DISABLE_PLOT |
+ |
+struct ctx_exec { |
+ int ctx; |
+ unsigned long long dtsc; |
+ unsigned long long dnsec; |
+ unsigned long long tsc_start; |
+ unsigned long long nsec_start; |
+}; |
+ |
+struct ctx_to_pid { |
+ int ctx; |
+ int pid; |
+}; |
+ |
+struct ctx_server { |
+ int ctx; |
+ int server_id; |
+ |
+}; |
+ |
+struct task_event { |
+ int ctx; |
+ unsigned long long tsc; |
+ unsigned long long nsec; |
+}; |
+ |
+struct server_event { |
+ int server_id; |
+ unsigned long long tsc; |
+ unsigned long long nsec; |
+}; |
+ |
+void Error(int num, int line) { |
+ printf("Finite-State machine error %d at line %d\n",num,line); |
+ exit(2); |
+} |
+ |
+int context_total = 0,endcycle_total = 0,job_total = 0,exec_total = 0; |
+struct ctx_exec *exec_list; |
+struct ctx_to_pid *context_list; |
+struct task_event *endcycle_list; |
+struct task_event *deadline_miss_list; |
+struct task_event *wcet_miss_list; |
+struct task_event *act_list; |
+struct ctx_exec *job_list; |
+struct ctx_server *ctx_server_list; |
+ |
+int server_exec_total = 0, server_end_total=0, server_act_total=0, ctx_server_total = 0, server_total=0; |
+struct server_event *act_server_list; |
+struct server_event *server_budget_end_list; |
+ |
+int deadline_miss = 0, wcet_miss = 0, act_total = 0; |
+ |
+unsigned int clk_per_msec = 0; |
+unsigned int skip_clk_per_msec = 0; |
+ |
+unsigned long long log_start_tsc = 0; |
+unsigned long long log_end_tsc = 0; |
+unsigned long long total_tsc = 0; |
+unsigned long long total_nsec = 0; |
+ |
+/* Data for gnuplot external call */ |
+int draw_data[DRAW_NUM+1]; |
+ |
+int gnuplot_clear() { |
+ |
+ int i; |
+ |
+ for (i=0;i<DRAW_NUM;i++) |
+ draw_data[i] = 0; |
+ |
+ return 0; |
+ |
+} |
+ |
+int gnuplot_draw(char *title,unsigned long long max_limit,int type) { |
+ |
+#ifndef DISABLE_PLOT |
+ |
+ FILE *gnuplot_data, *gnuplot_command; |
+ char temp_name[30]; |
+ int i,pid,*current_mem; |
+ |
+ current_mem = malloc(sizeof(int)*(DRAW_NUM+1)); |
+ memcpy(current_mem,draw_data,sizeof(int)*(DRAW_NUM+1)); |
+ |
+ pid = fork(); |
+ if (pid == 0) { |
+ |
+ srand(getpid()); |
+ |
+ sprintf(temp_name,"/tmp/pwcet%d",rand()%10000); |
+ |
+ gnuplot_data = fopen(temp_name,"w"); |
+ gnuplot_command = popen("gnuplot -persist","w"); |
+ |
+ for (i=0;i<DRAW_NUM;i++) |
+ fprintf(gnuplot_data,"%f\t%f\n",(double)i * (double)max_limit / (double)DRAW_NUM / 1000.0,(float)(current_mem[i])); |
+ |
+ fflush(gnuplot_data); |
+ fclose(gnuplot_data); |
+ |
+ fprintf(gnuplot_command,"set xlabel \"Time [us]\"\n"); |
+ if (type == 0) { |
+ fprintf(gnuplot_command,"set ylabel \"Frequency [#]\"\n"); |
+ |
+ fprintf(gnuplot_command,"plot \"%s\" using 1:2 title \"%s\" with lines\n",temp_name,title); |
+ fflush(gnuplot_command); |
+ } else { |
+ fprintf(gnuplot_command,"set ylabel \"Time [us]\"\n"); |
+ |
+ fprintf(gnuplot_command,"plot \"%s\" using 1:2 title \"%s\" with lines\n",temp_name,title); |
+ fflush(gnuplot_command); |
+ } |
+ |
+ pclose(gnuplot_command); |
+ exit(0); |
+ |
+ } |
+ |
+#endif |
+ |
+ return 0; |
+ |
+} |
+ |
+int stats_from_execs(int ctx_num, unsigned long long *tot_nsec, |
+ unsigned long long *min_nsec, |
+ unsigned long long *mean_nsec, |
+ unsigned long long *max_nsec, |
+ unsigned long long *first_nsec, |
+ int *number) { |
+ |
+ unsigned long long temp_nsec; |
+ int k,i; |
+ |
+ temp_nsec = 0; |
+ *max_nsec = 0; |
+ *mean_nsec = 0; |
+ *min_nsec = 0xFFFFFFFF; |
+ *first_nsec = 0; |
+ k = 0; |
+ for (i=0;i<exec_total;i++) |
+ if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
+ if (*first_nsec == 0) *first_nsec = exec_list[i].nsec_start; |
+ if (exec_list[i].dnsec > *max_nsec) *max_nsec = exec_list[i].dnsec; |
+ if (exec_list[i].dnsec < *min_nsec) *min_nsec = exec_list[i].dnsec; |
+ temp_nsec += exec_list[i].dnsec; |
+ k++; |
+ } |
+ |
+ *number = k; |
+ *tot_nsec = temp_nsec; |
+ if (k != 0) *mean_nsec = temp_nsec / k; |
+ |
+ return 0; |
+ |
+} |
+ |
+int stats_from_jobs(int ctx_num, unsigned long long *tot_nsec, |
+ unsigned long long *min_nsec, |
+ unsigned long long *mean_nsec, |
+ unsigned long long *max_nsec, |
+ unsigned long long *first_nsec, |
+ int *number) { |
+ |
+ unsigned long long temp_nsec; |
+ int k,i; |
+ |
+ temp_nsec = 0; |
+ *max_nsec = 0; |
+ *mean_nsec = 0; |
+ *min_nsec = 0xFFFFFFFF; |
+ *first_nsec = 0; |
+ k = 0; |
+ for (i=0;i<job_total;i++) |
+ if (job_list[i].ctx == context_list[ctx_num].ctx) { |
+ if (*first_nsec == 0) *first_nsec = job_list[i].nsec_start; |
+ if (job_list[i].dnsec > *max_nsec) *max_nsec = job_list[i].dnsec; |
+ if (job_list[i].dnsec < *min_nsec) *min_nsec = job_list[i].dnsec; |
+ temp_nsec += job_list[i].dnsec; |
+ k++; |
+ } |
+ |
+ *number = k; |
+ *tot_nsec = temp_nsec; |
+ if (k != 0) *mean_nsec = temp_nsec / k; |
+ |
+ return 0; |
+ |
+} |
+ |
+int arr_stats_from_execs(int ctx_num, unsigned long long *min_nsec, |
+ unsigned long long *mean_nsec, |
+ unsigned long long *max_nsec) { |
+ |
+ unsigned long long last_start,temp_nsec,delta_start; |
+ int i,k; |
+ |
+ last_start = 0; |
+ temp_nsec = 0; |
+ *max_nsec = 0; |
+ *min_nsec = 0xFFFFFFFF; |
+ *mean_nsec = 0; |
+ k = 0; |
+ for (i=0;i<exec_total;i++) |
+ if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
+ if (last_start == 0) { |
+ last_start = exec_list[i].nsec_start; |
+ } else { |
+ delta_start = exec_list[i].nsec_start - last_start; |
+ if (delta_start > *max_nsec) *max_nsec = delta_start; |
+ if (delta_start < *min_nsec) *min_nsec = delta_start; |
+ temp_nsec += delta_start; |
+ k++; |
+ last_start = exec_list[i].nsec_start; |
+ } |
+ } |
+ |
+ if (k != 0) *mean_nsec = temp_nsec / k; |
+ |
+ return 0; |
+ |
+} |
+ |
+int arr_stats_from_jobs(int ctx_num, unsigned long long *min_nsec, |
+ unsigned long long *mean_nsec, |
+ unsigned long long *max_nsec) { |
+ |
+ unsigned long long last_start,temp_nsec,delta_start; |
+ int i,k; |
+ |
+ last_start = 0; |
+ temp_nsec = 0; |
+ *max_nsec = 0; |
+ *min_nsec = 0xFFFFFFFF; |
+ *mean_nsec = 0; |
+ k = 0; |
+ for (i=0;i<job_total;i++) |
+ if (job_list[i].ctx == context_list[ctx_num].ctx) { |
+ if (last_start == 0) { |
+ last_start = job_list[i].nsec_start; |
+ } else { |
+ delta_start = job_list[i].nsec_start - last_start; |
+ if (delta_start > *max_nsec) *max_nsec = delta_start; |
+ if (delta_start < *min_nsec) *min_nsec = delta_start; |
+ temp_nsec += delta_start; |
+ k++; |
+ last_start = job_list[i].nsec_start; |
+ } |
+ } |
+ |
+ if (k != 0) *mean_nsec = temp_nsec / k; |
+ |
+ return 0; |
+ |
+} |
+ |
+int plot_exec_demand_function(int ctx_num, char *pidstr) { |
+ |
+ unsigned long long max_limit; |
+ char tmpstr[50]; |
+ int i; |
+ |
+ gnuplot_clear(); |
+ |
+ max_limit = total_nsec; |
+ |
+ for (i=0;i<exec_total;i++) |
+ if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
+ int h1,h2,h3; |
+ |
+ h1 = exec_list[i].nsec_start * DRAW_NUM / max_limit; |
+ h2 = (exec_list[i].nsec_start+exec_list[i].dnsec) * DRAW_NUM / max_limit; |
+ for (h3=h1;h3<h2;h3++) |
+ if (h3 <= DRAW_NUM) draw_data[h3] += exec_list[i].dnsec/1000*(h3-h1)/(h2-h1); |
+ for (h3=h2;h3<=DRAW_NUM;h3++) |
+ if (h3 <= DRAW_NUM) draw_data[h3] += exec_list[i].dnsec/1000; |
+ |
+ } |
+ |
+ sprintf(tmpstr,"Ctx [%d:%s] Demand-Function",context_list[ctx_num].ctx,pidstr); |
+ gnuplot_draw(tmpstr,max_limit,1); |
+ |
+ return 0; |
+ |
+} |
+ |
+int plot_exec_c_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
+ |
+ unsigned long long max_limit; |
+ char tmpstr[50]; |
+ int i,h; |
+ |
+ if (max_nsec == 0) return 0; |
+ |
+ gnuplot_clear(); |
+ |
+ max_limit = max_nsec; |
+ |
+ for (i=0;i<exec_total;i++) |
+ if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
+ h = exec_list[i].dnsec * DRAW_NUM / max_limit; |
+ if (h <= DRAW_NUM) draw_data[h]++; |
+ } |
+ |
+ sprintf(tmpstr,"Ctx [%d:%s] Exec C-dist",context_list[ctx_num].ctx,pidstr); |
+ gnuplot_draw(tmpstr,max_limit,0); |
+ |
+ return 0; |
+ |
+} |
+ |
+int plot_job_c_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
+ |
+ unsigned long long max_limit; |
+ char tmpstr[50]; |
+ int i,h; |
+ |
+ if (max_nsec == 0) return 0; |
+ |
+ gnuplot_clear(); |
+ |
+ max_limit = max_nsec; |
+ |
+ for (i=0;i<job_total;i++) |
+ if (job_list[i].ctx == context_list[ctx_num].ctx) { |
+ h = job_list[i].dnsec * DRAW_NUM / max_limit; |
+ if (h <= DRAW_NUM) draw_data[h]++; |
+ } |
+ |
+ sprintf(tmpstr,"Ctx [%d:%s] Job C-dist",context_list[ctx_num].ctx,pidstr); |
+ gnuplot_draw(tmpstr,max_limit,0); |
+ |
+ return 0; |
+ |
+} |
+ |
+int plot_exec_arr_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
+ |
+ unsigned long long max_limit,last_start,delta_start; |
+ char tmpstr[50]; |
+ int i,h; |
+ |
+ if (max_nsec == 0) return 0; |
+ |
+ gnuplot_clear(); |
+ |
+ max_limit = max_nsec; |
+ |
+ last_start = 0; |
+ for (i=0;i<exec_total;i++) |
+ if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
+ if (last_start == 0) { |
+ last_start = exec_list[i].nsec_start; |
+ } else { |
+ delta_start = exec_list[i].nsec_start - last_start; |
+ |
+ h = delta_start * DRAW_NUM / max_limit; |
+ if (h <= DRAW_NUM) draw_data[h]++; |
+ |
+ last_start = exec_list[i].nsec_start; |
+ } |
+ } |
+ |
+ sprintf(tmpstr,"Ctx [%d:%s] Exec Arr.Delta",context_list[ctx_num].ctx,pidstr); |
+ gnuplot_draw(tmpstr,max_limit,0); |
+ |
+ return 0; |
+ |
+} |
+ |
+int plot_job_arr_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
+ |
+ unsigned long long max_limit,last_start,delta_start; |
+ char tmpstr[50]; |
+ int i,h; |
+ |
+ if (max_nsec == 0) return 0; |
+ |
+ gnuplot_clear(); |
+ |
+ max_limit = max_nsec; |
+ |
+ last_start = 0; |
+ for (i=0;i<job_total;i++) |
+ if (job_list[i].ctx == context_list[ctx_num].ctx) { |
+ if (last_start == 0) { |
+ last_start = job_list[i].nsec_start; |
+ } else { |
+ delta_start = job_list[i].nsec_start - last_start; |
+ |
+ h = delta_start * DRAW_NUM / max_limit; |
+ if (h <= DRAW_NUM) draw_data[h]++; |
+ |
+ last_start = job_list[i].nsec_start; |
+ } |
+ } |
+ |
+ sprintf(tmpstr,"Ctx [%d:%s] Job Arr.Delta",context_list[ctx_num].ctx,pidstr); |
+ gnuplot_draw(tmpstr,max_limit,0); |
+ |
+ return 0; |
+ |
+} |
+ |
+int create_lists(char *filename) { |
+ |
+ FILE *input_file; |
+ |
+ int type,par1,par2,k,i,state; |
+ |
+ int current_context = 0; |
+ int current_exec = 0; |
+ int current_endcycle = 0; |
+ |
+ int kill_delta = 0; |
+ |
+ unsigned long long last_tsc, tsc; |
+ unsigned long long current_nsec = 0; |
+ |
+ input_file = fopen(filename,"r"); |
+ |
+ /* Memory alloc */ |
+ exec_list = malloc(sizeof(struct ctx_exec) * MAXJOB); |
+ context_list = malloc(sizeof(struct ctx_to_pid) * MAXCONTEXT); |
+ ctx_server_list = malloc(sizeof(struct ctx_server) * MAXCONTEXT); |
+ |
+ endcycle_list = malloc(sizeof(struct task_event) * MAXJOB); |
+ deadline_miss_list = malloc(sizeof(struct task_event) * MAXJOB); |
+ wcet_miss_list = malloc(sizeof(struct task_event) * MAXJOB); |
+ act_list = malloc(sizeof(struct task_event) * MAXJOB); |
+ |
+ act_server_list = malloc(sizeof(struct server_event) * MAXJOB ); |
+ server_budget_end_list = malloc(sizeof(struct server_event) * MAXJOB); |
+ |
+ |
+ /* Finite-State machine |
+ * |
+ * FS-Machine states: |
+ |
+ 0 - Start |
+ 1 - Context running |
+ 2 - Interrupt running |
+ |
+ 10 - End |
+ |
+ */ |
+ |
+ for(i=0;i<MAXCONTEXT;i++) { |
+ context_list[i].ctx = 0; |
+ context_list[i].pid = PID_NO_DEF; |
+ } |
+ |
+ for(i=0; i<MAXCONTEXT; i++) { |
+ ctx_server_list[i].ctx=0; |
+ ctx_server_list[i].server_id=SERVER_NO_DEF; |
+ |
+ } |
+ |
+ /* The start context + interrupt context */ |
+ context_total = 2; |
+ current_context = 0; |
+ last_tsc = 0; |
+ context_list[0].ctx = 0; |
+ context_list[0].pid = PID_NO_DEF; |
+ context_list[1].ctx = INT_CTX; |
+ context_list[1].pid = INT_PID; |
+ |
+ state = 0; |
+ |
+ k = 0; |
+ while(!feof(input_file)) { |
+ |
+ fscanf(input_file,"%d %llu",&type,&tsc); |
+ k++; |
+ |
+ switch (type) { |
+ |
+ case 1: |
+ |
+ /* No par */ |
+ break; |
+ |
+ case 2: |
+ case 3: |
+ case 4: |
+ case 6: |
+ case 7: |
+ case 8: |
+ case 10: |
+ case 11: |
+ case 12: |
+ case 13: |
+ case 14: |
+ case 15: |
+ /* 1 par */ |
+ fscanf(input_file,"%d",&par1); |
+ break; |
+ |
+ case 5: |
+ case 9: |
+ case 0: |
+ case 16: |
+ case 17: |
+ case 20: |
+ case 21: |
+ |
+ /* 2 par */ |
+ fscanf(input_file,"%d %d",&par1,&par2); |
+ break; |
+ |
+ } |
+ |
+ switch (type) { |
+ |
+ case 0: |
+ if (state != 0) Error(1,k); |
+ printf("EVT:Log starts at [%12llu]\n",tsc); |
+ last_tsc = tsc; |
+ log_start_tsc = tsc; |
+ current_nsec = 0; |
+ |
+ if (par1 == 0) Error(11,k); |
+ if (par2 == 0) Error(12,k); |
+ |
+ current_context = par1; |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ if (i == context_total) { |
+ context_list[context_total].ctx = par1; |
+ context_total++; |
+ } |
+ |
+ clk_per_msec = par2; |
+ |
+ exec_list[current_exec].tsc_start = tsc; |
+ exec_list[current_exec].nsec_start = current_nsec; |
+ state = 1; |
+ break; |
+ |
+ case 1: |
+ printf("EVT:Log ends at [%12llu]\n",tsc); |
+ exec_list[current_exec].dtsc = tsc - last_tsc; |
+ exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
+ current_nsec += exec_list[current_exec].dnsec; |
+ exec_list[current_exec].ctx = current_context; |
+ current_exec++; |
+ last_tsc = tsc; |
+ log_end_tsc = tsc; |
+ total_nsec = current_nsec; |
+ state = 10; |
+ break; |
+ |
+ /* Int start */ |
+ case 2: |
+ if (state == 0) Error(2,k); |
+ exec_list[current_exec].dtsc = tsc - last_tsc; |
+ exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
+ current_nsec += exec_list[current_exec].dnsec; |
+ exec_list[current_exec].ctx = current_context; |
+ current_exec++; |
+ last_tsc = tsc; |
+ current_context = INT_CTX; |
+ exec_list[current_exec].tsc_start = tsc - log_start_tsc; |
+ exec_list[current_exec].nsec_start = current_nsec; |
+ state = 2; |
+ break; |
+ |
+ /* Int end */ |
+ case 3: |
+ if (state != 2) Error(3,k); |
+ exec_list[current_exec].dtsc = tsc - last_tsc; |
+ exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
+ current_nsec += exec_list[current_exec].dnsec; |
+ exec_list[current_exec].ctx = current_context; |
+ current_exec++; |
+ last_tsc = tsc; |
+ if (par1 > 16) { |
+ current_context = par1; |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ if (i == context_total) { |
+ context_list[context_total].ctx = par1; |
+ context_total++; |
+ } |
+ } |
+ |
+ exec_list[current_exec].tsc_start = tsc; |
+ exec_list[current_exec].nsec_start = current_nsec; |
+ state = 1; |
+ break; |
+ |
+ /* Change ctx */ |
+ case 4: |
+ |
+ exec_list[current_exec].dtsc = tsc - last_tsc; |
+ exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
+ current_nsec += exec_list[current_exec].dnsec; |
+ exec_list[current_exec].ctx = current_context; |
+ current_exec++; |
+ last_tsc = tsc; |
+ current_context = par1; |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ if (i == context_total) { |
+ context_list[context_total].ctx = par1; |
+ context_total++; |
+ } |
+ |
+ exec_list[current_exec].tsc_start = tsc; |
+ exec_list[current_exec].nsec_start = current_nsec; |
+ state = 1; |
+ break; |
+ |
+ /* Task create */ |
+ case 5: |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) { |
+ context_list[i].pid = par2; |
+ break; |
+ } |
+ if (i == context_total) { |
+ context_list[context_total].ctx = par1; |
+ context_list[context_total].pid = par2; |
+ context_total++; |
+ } |
+ |
+ break; |
+ |
+ /* Task kill */ |
+ case 7: |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ if (i == context_total) Error(5,k); |
+ else { |
+ |
+ kill_delta += 1000; |
+ |
+ for (k=0;k<current_endcycle;k++) |
+ if (endcycle_list[k].ctx == par1) |
+ endcycle_list[k].ctx += kill_delta; |
+ for (k=0;k<current_exec;k++) |
+ if (exec_list[k].ctx == par1) |
+ exec_list[k].ctx += kill_delta; |
+ context_list[context_total].ctx = context_list[i].ctx + kill_delta; |
+ context_list[context_total].pid = context_list[i].pid; |
+ context_total++; |
+ |
+ if (current_context == par1) current_context += kill_delta; |
+ |
+ } |
+ |
+ break; |
+ |
+ /* Task endcycle */ |
+ case 8: |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ if (i == context_total) Error(4,k); |
+ |
+ endcycle_list[current_endcycle].ctx = par1; |
+ endcycle_list[current_endcycle].tsc = tsc; |
+ endcycle_list[current_endcycle].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
+ current_endcycle++; |
+ |
+ break; |
+ |
+ /* Task activate */ |
+ case 6: |
+ |
+ act_list[act_total].ctx = par1; |
+ act_list[act_total].tsc = tsc; |
+ act_list[act_total].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
+ act_total++; |
+ |
+ break; |
+ /* Server Create */ |
+ case 16: |
+ for (i=0;i<ctx_server_total;i++) |
+ if (par1 == ctx_server_list[i].ctx) { |
+ ctx_server_list[i].server_id = par2; |
+ break; |
+ } |
+ if (i == ctx_server_total) { |
+ ctx_server_list[ctx_server_total].ctx = par1; |
+ ctx_server_list[ctx_server_total].server_id = par2; |
+ ctx_server_total++; |
+ } |
+ printf("(%d, %d, %d)", ctx_server_total, par1, par2); |
+ break; |
+ |
+ /* Deadline miss */ |
+ case 20: |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ //if (i == context_total) Error(4,k); |
+ |
+ deadline_miss_list[deadline_miss].ctx = par1; |
+ deadline_miss_list[deadline_miss].tsc = tsc; |
+ deadline_miss_list[deadline_miss].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
+ deadline_miss++; |
+ |
+ break; |
+ |
+ /* Wcet miss */ |
+ case 21: |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) break; |
+ //if (i == context_total) Error(4,k); |
+ |
+ wcet_miss_list[wcet_miss].ctx = par1; |
+ wcet_miss_list[wcet_miss].tsc = tsc; |
+ wcet_miss_list[wcet_miss].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
+ wcet_miss++; |
+ |
+ break; |
+ |
+ /* Task id */ |
+ case 9: |
+ |
+ for (i=0;i<context_total;i++) |
+ if (par1 == context_list[i].ctx) { |
+ context_list[i].pid = par2; |
+ break; |
+ } |
+ if (i == context_total) { |
+ context_list[context_total].ctx = par1; |
+ context_list[context_total].pid = par2; |
+ context_total++; |
+ } |
+ |
+ break; |
+ |
+ case 10: |
+ |
+ exec_list[current_exec].dtsc = tsc - last_tsc; |
+ exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
+ current_nsec += exec_list[current_exec].dnsec; |
+ exec_list[current_exec].ctx = current_context; |
+ current_exec++; |
+ last_tsc = tsc; |
+ |
+ exec_list[current_exec].tsc_start = tsc; |
+ exec_list[current_exec].nsec_start = current_nsec; |
+ |
+ if (!skip_clk_per_msec) clk_per_msec = par1; |
+ |
+ break; |
+ |
+ } |
+ |
+ if (current_exec == MAXJOB-1) { |
+ printf("Too many execs...\n"); |
+ exit(3); |
+ } |
+ |
+ if (current_endcycle == MAXJOB-1 || act_total == MAXJOB-1 |
+ || deadline_miss == MAXJOB-1 || wcet_miss == MAXJOB-1) { |
+ printf("Too many jobs...\n"); |
+ exit(4); |
+ } |
+ |
+ if (state == 10) break; |
+ |
+ } |
+ |
+ endcycle_total = current_endcycle; |
+ exec_total = current_exec; |
+ |
+ return k; |
+ |
+} |
+ |
+int task_events(int num, int *act, int *dlinemiss, int *wcetmiss) { |
+ |
+ unsigned long long i; |
+ int tmp = 0; |
+ |
+ *act = 0; |
+ *dlinemiss = 0; |
+ *wcetmiss = 0; |
+ |
+ tmp = 0; |
+ for (i=0;i<act_total;i++) |
+ if (act_list[i].ctx == context_list[num].ctx) tmp++; |
+ *act = tmp; |
+ tmp = 0; |
+ for (i=0;i<deadline_miss;i++) |
+ if (deadline_miss_list[i].ctx == context_list[num].ctx) tmp++; |
+ *dlinemiss = tmp; |
+ tmp = 0; |
+ for (i=0;i<wcet_miss;i++) |
+ if (wcet_miss_list[i].ctx == context_list[num].ctx) tmp++; |
+ *wcetmiss = tmp; |
+ |
+ return 0; |
+ |
+} |
+ |
+int create_job_list() { |
+ |
+ int current_job = 0, h, i, k; |
+ int temp_ctx; |
+ unsigned long long temp_nsec, endcycle_start_nsec; |
+ unsigned long long temp_tsc, endcycle_end_nsec; |
+ |
+ job_list = malloc(sizeof(struct ctx_exec) * MAXJOB); |
+ |
+ for (k=0;k<context_total;k++) { |
+ |
+ temp_ctx = context_list[k].ctx; |
+ endcycle_start_nsec = 0; |
+ |
+ for (h=0;h<endcycle_total;h++) { |
+ |
+ if (endcycle_list[h].ctx == temp_ctx) { |
+ |
+ if (endcycle_start_nsec == 0) |
+ endcycle_start_nsec = 0; |
+ |
+ endcycle_end_nsec = endcycle_list[h].nsec; |
+ temp_nsec = 0; |
+ temp_tsc = 0; |
+ |
+ job_list[current_job].nsec_start = 0; |
+ |
+ for(i=0;i<exec_total;i++) |
+ if (exec_list[i].ctx == temp_ctx) { |
+ if (exec_list[i].nsec_start < endcycle_end_nsec && |
+ exec_list[i].nsec_start >= endcycle_start_nsec) { |
+ if (job_list[current_job].nsec_start == 0) |
+ job_list[current_job].nsec_start = exec_list[i].nsec_start; |
+ temp_nsec += exec_list[i].dnsec; |
+ temp_tsc += exec_list[i].dtsc; |
+ } |
+ } |
+ |
+ job_list[current_job].dtsc = temp_tsc; |
+ job_list[current_job].dnsec = temp_nsec; |
+ job_list[current_job].ctx = temp_ctx; |
+ current_job++; |
+ |
+ endcycle_start_nsec = endcycle_end_nsec; |
+ |
+ } |
+ |
+ } |
+ |
+ } |
+ |
+ job_total = current_job; |
+ |
+ return 0; |
+ |
+} |
+ |
+int elaborate_statistics(int num, int task_type) { |
+ |
+ char pidstr[10]; |
+ char serverstr[10]; |
+ unsigned long long tot_nsec,mean_nsec,max_nsec,min_nsec,first_nsec; |
+ int number,act,dlinemiss,wcetmiss; |
+ int i=0; |
+ |
+ switch (context_list[num].pid) { |
+ case PID_NO_DEF: |
+ sprintf(pidstr,"NODEF"); |
+ break; |
+ case INT_PID: |
+ sprintf(pidstr," INT"); |
+ break; |
+ default: |
+ sprintf(pidstr,"%5d",context_list[num].pid); |
+ break; |
+ } |
+ |
+ for (i=0; i<ctx_server_total; i++) { |
+ if (ctx_server_list[i].ctx==context_list[num].ctx) { |
+ sprintf(serverstr,"%5d", ctx_server_list[i].server_id); |
+ break; |
+ } |
+ } |
+ |
+ if (i==ctx_server_total) |
+ sprintf(serverstr, "NODEF"); |
+ |
+ |
+ if (task_type == BACKGROUND) { |
+ |
+ printf("Background Task CTX [%5d] PID [%s] SERVER [%s]\n",context_list[num].ctx,pidstr, serverstr); |
+ |
+ stats_from_execs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
+ |
+ if (number > 0) { |
+ |
+ printf(" Total Execution [%12llu ns]\n",tot_nsec); |
+ printf(" Mean CPU Bandwidth [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec)*100.0,'%'); |
+ printf(" after first exec [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec-first_nsec)*100.0,'%'); |
+ printf(" Execs Number [%12d ]\n",number); |
+ printf(" Min Exec [%12llu ns]\n",min_nsec); |
+ printf(" Mean Exec [%12llu ns]\n",mean_nsec); |
+ printf(" Max Exec [%12llu ns]\n\n",max_nsec); |
+ |
+ plot_exec_demand_function(num,pidstr); |
+ |
+ } else { |
+ |
+ printf(" Total Execution [%12llu ns]\n\n",tot_nsec); |
+ |
+ } |
+ |
+ } |
+ |
+ if (task_type == INTERRUPT) { |
+ |
+ printf("Interrupts\n"); |
+ |
+ stats_from_execs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
+ |
+ if (number > 0) { |
+ |
+ printf(" Total Execution [%12llu ns]\n",tot_nsec); |
+ printf(" Mean CPU Bandwidth [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec)*100.0,'%'); |
+ printf(" after first int [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec-first_nsec)*100.0,'%'); |
+ printf(" Interrupts Number [%12d ]\n",number); |
+ printf(" Min Interrupt [%12llu ns]\n",min_nsec); |
+ printf(" Mean Interrupt [%12llu ns]\n",mean_nsec); |
+ printf(" Max Interrupt [%12llu ns]\n\n",max_nsec); |
+ |
+ plot_exec_demand_function(num,pidstr); |
+ |
+ plot_exec_c_distrib(num,max_nsec,pidstr); |
+ |
+ arr_stats_from_execs(num,&min_nsec,&mean_nsec,&max_nsec); |
+ |
+ if (max_nsec > 0) { |
+ |
+ printf(" Min Arr. Delta [%12llu ns]\n",min_nsec); |
+ printf(" Mean Arr. Delta [%12llu ns]\n",mean_nsec); |
+ printf(" Max Arr. Delta [%12llu ns]\n\n",max_nsec); |
+ |
+ plot_exec_arr_distrib(num,max_nsec,pidstr); |
+ |
+ } |
+ |
+ } else { |
+ |
+ printf(" Total Execution [%12llu ns]\n\n",tot_nsec); |
+ |
+ } |
+ |
+ } |
+ |
+ if (task_type == PERIODICAL) { |
+ |
+ printf("Periodical Task CTX [%5d] PID [%s] SERVER [%s]\n",context_list[num].ctx,pidstr,serverstr); |
+ |
+ stats_from_execs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
+ |
+ if (number > 0) { |
+ |
+ printf(" Total Execution [%12llu ns]\n",tot_nsec); |
+ printf(" Mean CPU Bandwidth [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec)*100.0,'%'); |
+ printf(" after first exec [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec-first_nsec)*100.0,'%'); |
+ printf(" Execs Number [%12d ]\n",number); |
+ printf(" Min Exec [%12llu ns]\n",min_nsec); |
+ printf(" Mean Exec [%12llu ns]\n",mean_nsec); |
+ printf(" Max Exec [%12llu ns]\n\n",max_nsec); |
+ |
+ plot_exec_demand_function(num,pidstr); |
+ |
+ stats_from_jobs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
+ |
+ printf(" Total Job Exec [%12llu ns]\n",tot_nsec); |
+ printf(" Jobs Number [%12d ]\n",number); |
+ printf(" Min Job [%12llu ns]\n",min_nsec); |
+ printf(" Mean Job [%12llu ns]\n",mean_nsec); |
+ printf(" Max Job [%12llu ns]\n\n",max_nsec); |
+ |
+ task_events(num,&act,&dlinemiss,&wcetmiss); |
+ |
+ printf(" Activations [%12d ]\n",act); |
+ printf(" Deadline Miss [%12d ]\n",dlinemiss); |
+ printf(" Wcet Miss [%12d ]\n\n",wcetmiss); |
+ |
+ plot_job_c_distrib(num,max_nsec,pidstr); |
+ |
+ arr_stats_from_jobs(num,&min_nsec,&mean_nsec,&max_nsec); |
+ |
+ if (max_nsec > 0) { |
+ |
+ printf(" Min Arr. Delta [%12llu ns]\n",min_nsec); |
+ printf(" Mean Arr. Delta [%12llu ns]\n",mean_nsec); |
+ printf(" Max Arr. Delta [%12llu ns]\n\n",max_nsec); |
+ |
+ plot_job_arr_distrib(num,max_nsec,pidstr); |
+ |
+ } |
+ |
+ } else { |
+ |
+ printf(" Total Execution [%12llu ns]\n\n",tot_nsec); |
+ |
+ } |
+ |
+ } |
+ |
+ return 0; |
+ |
+} |
+ |
+int main(int argc, char *argv[]) { |
+ |
+ int events_total,k,i; |
+ int task_type; |
+ |
+ unsigned long long temp_nsec; |
+ |
+ srand(getpid()); |
+ |
+ if (argc < 2) { |
+ printf("%s: Enter the input file name \"%s filename.pwc [clk_per_msec]\"\n",argv[0],argv[0]); |
+ exit(1); |
+ } |
+ |
+ printf("\n"); |
+ |
+ if (argc == 3) { |
+ skip_clk_per_msec = 1; |
+ clk_per_msec = atoi(argv[2]); |
+ printf("Clk/msec = %u\n\n",clk_per_msec); |
+ } |
+ |
+ events_total = create_lists(argv[1]); |
+ |
+ total_tsc = log_end_tsc - log_start_tsc; |
+ |
+ printf("\nTotal dTSC [%12llu] ns [%12llu]\n", total_tsc, total_nsec); |
+ printf("Events [%12d]\n",events_total); |
+ printf("Execs [%12d]\n",exec_total); |
+ printf("EndCycles [%12d]\n",endcycle_total); |
+ printf("Dline miss [%12d]\n",deadline_miss); |
+ printf("WCET miss [%12d]\n",wcet_miss); |
+ |
+ printf("\nPreemption Removing.... \n"); |
+ |
+ /* Remove preemption from the computation time */ |
+ create_job_list(); |
+ |
+ temp_nsec = 0; |
+ for (i=0;i<job_total;i++) |
+ temp_nsec += job_list[i].dnsec; |
+ |
+ printf("Total nsec of jobs [%12llu]\n",temp_nsec); |
+ |
+ temp_nsec = 0; |
+ for (i=0;i<exec_total;i++) |
+ temp_nsec += exec_list[i].dnsec; |
+ |
+ printf("Total nsec of exec [%12llu]\n",temp_nsec); |
+ printf("Total nsec considering last clk/msec [%12llu]\n",total_tsc*1000000/clk_per_msec); |
+ |
+ printf("\nCompute Task Statistics.... \n\n"); |
+ |
+ for (i=0;i<context_total;i++) { |
+ |
+ task_type = BACKGROUND; |
+ |
+ if (context_list[i].ctx == INT_CTX) task_type = INTERRUPT; |
+ |
+ for (k=0;k<job_total;k++) |
+ if (job_list[k].ctx == context_list[i].ctx) { |
+ task_type = PERIODICAL; |
+ break; |
+ } |
+ |
+ elaborate_statistics(i,task_type); |
+ |
+ } |
+ |
+ return 0; |
+ |
+} |
+ |
Index: xen/newtrace/utils/list.c |
=================================================================== |
--- xen/newtrace/utils/list.c (nonexistent) |
+++ xen/newtrace/utils/list.c (revision 1684) |
@@ -0,0 +1,112 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Giacomo Guidi <giacomo@gandalf.sssup.it> |
+ * Tullio Facchinetti <tullio.facchinetti@unipv.it> |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ * http://robot.unipv.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <stdio.h> |
+#include <unistd.h> |
+#include <stdlib.h> |
+#include <string.h> |
+ |
+#define READ_BUFFER 2000 |
+#define DELTA_BUFFER 100 |
+ |
+int main(int argc, char *argv[]) |
+{ |
+ |
+ char buffer[READ_BUFFER+DELTA_BUFFER]; |
+ void *p, *last; |
+ int n,delta,size; |
+ |
+ unsigned long long tsc_value; |
+ |
+ unsigned long long ev = 0; |
+ |
+ FILE *input_file; |
+ |
+ if (argc < 2) { |
+ printf("%s: Enter the input file name [%s filename]\n",argv[0],argv[0]); |
+ exit(1); |
+ } |
+ |
+ input_file = fopen(argv[1],"rb"); |
+ |
+ last = buffer + READ_BUFFER; |
+ |
+ while(!feof(input_file)) { |
+ |
+ //move remaining byte |
+ delta = (unsigned int)(buffer) + READ_BUFFER - (unsigned int)(last); |
+ if (delta > 0) memcpy(buffer,last,delta); |
+ |
+ n = fread(buffer+delta,1,READ_BUFFER+10,input_file); |
+ fseek(input_file,-(delta+10),SEEK_CUR); |
+ |
+ p = buffer; |
+ |
+ while ((unsigned int)(p) + 16 <= (unsigned int)(buffer + READ_BUFFER) && |
+ (unsigned int)(p) + 16 <= (unsigned int)(buffer + n + delta)) { |
+ |
+ printf("%08d Type = %02x ",(unsigned int)ev,*(unsigned short int *)(p)); |
+ |
+ tsc_value = (unsigned long long)(*(unsigned int *)(p+4)) << 32; |
+ tsc_value += (unsigned long long)(*(unsigned int *)(p+8)); |
+ |
+ printf("TSC = %llu (%08x:%08x)",tsc_value, *(unsigned int *)(p+4),*(unsigned int *)(p+8)); |
+ |
+ size = 16; |
+ |
+ printf(" Par1 = %11d",*(unsigned short int *)(p+2)); |
+ printf(" Par2 = %11d\n",*(unsigned int *)(p+12)); |
+ |
+ ev++; |
+ |
+ p += 16; |
+ |
+ if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
+ |
+ last = p; |
+ |
+ } |
+ |
+ if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
+ |
+ } |
+ |
+ fclose(input_file); |
+ |
+ return 0; |
+ |
+} |
+ |
Index: xen/newtrace/utils/pwcet_gen.c |
=================================================================== |
--- xen/newtrace/utils/pwcet_gen.c (nonexistent) |
+++ xen/newtrace/utils/pwcet_gen.c (revision 1684) |
@@ -0,0 +1,275 @@ |
+/* |
+ * Project: S.Ha.R.K. |
+ * |
+ * Coordinators: |
+ * Giorgio Buttazzo <giorgio@sssup.it> |
+ * Paolo Gai <pj@gandalf.sssup.it> |
+ * |
+ * Authors : |
+ * Giacomo Guidi <giacomo@gandalf.sssup.it> |
+ * |
+ * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
+ * |
+ * http://www.sssup.it |
+ * http://retis.sssup.it |
+ * http://shark.sssup.it |
+ */ |
+ |
+/* |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License as published by |
+ * the Free Software Foundation; either version 2 of the License, or |
+ * (at your option) any later version. |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ */ |
+ |
+#include <stdio.h> |
+#include <unistd.h> |
+#include <stdlib.h> |
+#include <string.h> |
+ |
+#include <FTrace.h> |
+ |
+#define READ_BUFFER 2000 |
+#define DELTA_BUFFER 100 |
+ |
+int main(int argc, char *argv[]) |
+{ |
+ |
+ char buffer[READ_BUFFER+DELTA_BUFFER]; |
+ void *p, *last; |
+ int n,delta,size,tsc; |
+ |
+ unsigned long long ev = 0, tsc_value; |
+ |
+ FILE *input_file; |
+ |
+ if (argc < 2) { |
+ printf("%s: Enter the input file name [%s filename]\n",argv[0],argv[0]); |
+ exit(1); |
+ } |
+ |
+ input_file = fopen(argv[1],"rb"); |
+ |
+ last = buffer + READ_BUFFER; |
+ |
+ while(!feof(input_file)) { |
+ |
+ //move remaining byte |
+ delta = (unsigned int)(buffer) + READ_BUFFER - (unsigned int)(last); |
+ if (delta > 0) memcpy(buffer,last,delta); |
+ |
+ n = fread(buffer+delta,1,READ_BUFFER+10,input_file); |
+ fseek(input_file,-(delta+10),SEEK_CUR); |
+ |
+ p = buffer; |
+ /* |
+ // specific server events |
+ #define FTrace_EVT_server_create 0x08 // Par1 [empty] Par2 [server] |
+ #define FTrace_EVT_server_replenish 0x18 // Par1 [empty] Par2 [server] |
+ #define FTrace_EVT_server_exhaust 0x28 // Par1 [empty] Par2 [server] |
+ #define FTrace_EVT_server_reclaiming 0x38 // Par1 [empty] Par2 [server] |
+ #define FTrace_EVT_server_remove 0x48 // Par1 [empty] Par2 [server] |
+ #define FTrace_EVT_server_active 0x58 // Par1 [empty] Par2 [server] |
+ #define FTrace_EVT_server_using_rec 0x68 // Par1 [reclaiming] Par2 [server] |
+ */ |
+ |
+ while ((unsigned int)(p) + 16 <= (unsigned int)(buffer + READ_BUFFER) && |
+ (unsigned int)(p) + 16 <= (unsigned int)(buffer + n + delta)) { |
+ |
+ tsc = 0; |
+ |
+ switch (*(unsigned short int *)(p) & 0x00FF) { |
+ |
+ case FTrace_EVT_ipoint: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ tsc = 1; |
+ break; |
+ |
+ /* Tracer start */ |
+ case FTrace_EVT_trace_start: |
+ printf("0 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Tracer stop */ |
+ case FTrace_EVT_trace_stop: |
+ printf("1 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Interrupt start (int num) */ |
+ case FTrace_EVT_timer_wakeup_start: |
+ case FTrace_EVT_interrupt_start: |
+ printf("2 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Interrupt Stop (int num, or context num is int 3) */ |
+ case FTrace_EVT_timer_wakeup_end: |
+ case FTrace_EVT_interrupt_end: |
+ printf("3 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Context to (context num) */ |
+ case FTrace_EVT_context_switch: |
+ printf("4 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Task Create (context num, pid num) */ |
+ case FTrace_EVT_task_create: |
+ printf("5 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Task Activate (context num) */ |
+ case FTrace_EVT_task_activate: |
+ printf("6 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Task End (context num) */ |
+ case FTrace_EVT_task_end: |
+ printf("7 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Task End-Cycle (context num) */ |
+ case FTrace_EVT_task_end_cycle: |
+ printf("8 "); |
+ tsc = 1; |
+ break; |
+ |
+ /* Task Context - PID declaration */ |
+ case FTrace_EVT_id: |
+ printf("9 "); |
+ tsc = 1; |
+ break; |
+ |
+ case FTrace_EVT_cycles_per_msec: |
+ printf("10 "); |
+ tsc = 1; |
+ break; |
+ // specific server events |
+ |
+ case FTrace_EVT_server_active: |
+ printf("16 "); |
+ tsc=1; |
+ break; |
+ |
+ case FTrace_EVT_task_deadline_miss: |
+ printf("20 "); |
+ tsc = 1; |
+ break; |
+ |
+ case FTrace_EVT_task_wcet_violation: |
+ printf("21 "); |
+ tsc = 1; |
+ break; |
+ |
+ } |
+ |
+ tsc_value = (unsigned long long)(*(unsigned int *)(p+4)) << 32; |
+ tsc_value += (unsigned long long)(*(unsigned int *)(p+8)); |
+ |
+ if (tsc == 1) { |
+ |
+ printf("%llu ",tsc_value); |
+ |
+ switch (*(unsigned short int *)(p) & 0x00FF) { |
+ |
+ case FTrace_EVT_trace_start: |
+ printf("%d %d ",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
+ break; |
+ |
+ case FTrace_EVT_interrupt_start: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ break; |
+ |
+ case FTrace_EVT_timer_wakeup_start: |
+ printf("%d ",0); |
+ break; |
+ |
+ case FTrace_EVT_timer_wakeup_end: |
+ case FTrace_EVT_interrupt_end: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ break; |
+ |
+ case FTrace_EVT_context_switch: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ break; |
+ |
+ case FTrace_EVT_task_create: |
+ printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
+ break; |
+ |
+ case FTrace_EVT_task_deadline_miss: |
+ printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
+ break; |
+ |
+ case FTrace_EVT_task_wcet_violation: |
+ printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
+ break; |
+ |
+ case FTrace_EVT_task_activate: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ break; |
+ |
+ case FTrace_EVT_task_end_cycle: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ break; |
+ |
+ case FTrace_EVT_task_end: |
+ printf("%d ",*(unsigned short int *)(p+2)); |
+ break; |
+ |
+ case FTrace_EVT_id: |
+ printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
+ break; |
+ |
+ case FTrace_EVT_cycles_per_msec: |
+ printf("%d ",*(unsigned int *)(p+12)); |
+ break; |
+ |
+ case FTrace_EVT_server_active: |
+ printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
+ break; |
+ } |
+ |
+ printf("\n"); |
+ |
+ } |
+ |
+ size = 16; |
+ |
+ ev++; |
+ |
+ p += 16; |
+ |
+ if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
+ |
+ last = p; |
+ |
+ } |
+ |
+ if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
+ |
+ } |
+ |
+ fclose(input_file); |
+ |
+ return 0; |
+ |
+} |
+ |
Index: xen/newtrace/utils/test |
=================================================================== |
--- xen/newtrace/utils/test (nonexistent) |
+++ xen/newtrace/utils/test (revision 1684) |
@@ -0,0 +1,919 @@ |
+ ®'¿¨{ ` Á(¿¨ ` *¿¨ ` ?+¿¨ ` ,¿¨ ` À-¿¨ ( Á¨ ( !Á¨ ,Á¨ W8Á¨ ( $:Á¨ BÁ¨ ( OÁ¨( SÁ¨ ( ÂXÁ¨ Á¨ ËïÁ¨ b ( õÁ¨ ,ùÁ¨ 0ûÁ¨ Ä Â¨ B HV¨ =d¨ Ih¨ 'j¨ + 4tø¨ iø¨ ø¨ Íø¨ ; Yø¨ ¶ø¨ b ؽø¨ PÁø¨ lÂø¨ + -ù¨ Û1ù¨ B4ù¨ ( n5ù¨ ( "8ù¨( ï:ù¨ ; ( |
+>ù¨ èù¨ >ù¨ b ( àù¨ ¯ù¨ Çù¨ + 0© ; ¦0© + =1© Ô?1© B1© ( >C1© ( ÈE1©( uG1© ; ( {I1© ¶1© Ù 1© b ( £1© ä1© Ð¥1© + Oi© ÂQi© Ti© ( (Ui© ( Wi©( Yi© ; ( ÿZi© §¯i© ¥±i© b ( ɳi© µi© ¶i© + %c¡© Xe¡© g¡© ( °h¡© ( k¡©( l¡© ; ( n¡© á© öÄ¡© b ( Ç¡© ÌÈ¡© ÙÉ¡© + uÙ© MwÙ© yÙ© ( ¸zÙ© ( }Ù©( ~Ù© ; ( Ù© DÕÙ© 5×Ù© b ( ½ØÙ© rÚÙ© ÛÙ© + Ϫ Òª Ôª ïÖª ; Úª ¡ãª b .çª Ñèª àéª + ˪ ,ª oª ( £ª ( ª( Áª ; ( ôª §éª ìëª b ( síª 2ïª Aðª + èHª ; ¥êHª + >Iª Iª ÖIª ( ú Iª ( £Iª( 7¥Iª ; ( 1§Iª üIª þIª b ( F Jª Jª +Jª + 3®ª p°ª IJª ( 볪 ( K¶ª( Í·ª ; ( ¾¹ª 3ª %ª b ( Iª |
+ª ª + 6À¹ª h¹ª Ĺª ( ¸Å¹ª ( ȹª( ɹª ; ( ˹ª & ºª "ºª b ( ;$ºª ò%ºª ÿ&ºª + Óñª ÑÕñª 'Øñª ( CÙñª ( Ûñª( Ýñª ; ( +ßñª 3òª 5òª b ( 7òª Æ8òª Õ9òª + ü+)« ¹.)« å0)« ³3)« ; Ñ6)« Q@)« b C)« ?E)« NF)« + úå)« [è)« Cë)« ( Wì)« ( °î)«( ^ð)« ; ( ò)« JH*« °J*« b ( 8L*« ýM*« O*« + êCa« ; Fa« + øa« Øúa« ýa« ( :þa« ( b«( (b« ; ( ,b« ÍXb« ÌZb« b ( ü\b« ±^b« Í_b« + R« « ׫ ( è« ( H«( É« ; ( º« <l« -n« b ( Qp« r« s« + ?Ò« m Ò« ¡"Ò« ( ¹#Ò« ( &Ò«( 'Ò« ; ( )Ò« ÷}Ò« éÒ« b ( +Ò« ÃÒ« ÐÒ« + e1 |
+¬ ¦3 |
+¬ í5 |
+¬ ( ø6 |
+¬ ( K9 |
+¬( Ì: |
+¬ ; ( Î< |
+¬ t |
+¬ h |
+¬ b ( ð |
+¬ § |
+¬ ¶ |
+¬ + IA¬ |
+A¬ A¬ ×A¬ ; øA¬ aA¬ b ©¢A¬ X¤A¬ g¥A¬ + °CB¬ +FB¬ lHB¬ ( IB¬ ( õKB¬( ¤MB¬ ; ( ÃOB¬ +¥B¬ n§B¬ b ( ç¨B¬ ¦ªB¬ µ«B¬ + £y¬ ; ,¦y¬ + ÆVz¬ Yz¬ C[z¬ ( Z\z¬ ( ¸^z¬( U`z¬ ; ( Zbz¬ .·z¬ S¹z¬ b ( y»z¬ 3½z¬ O¾z¬ + hi²¬ °k²¬ n²¬ ( 8o²¬ ( ×q²¬( is²¬ ; ( Zu²¬ ¥É²¬ Ó˲¬ b ( β¬ µÏ²¬ Äв¬ + `}ê¬ ê¬ ×ê¬ ( ûê¬ ( ~ ê¬( ê¬ ; ( õê¬ QÝê¬ Gßê¬ b ( káê¬ "ãê¬ /äê¬ + X" " à" ( ü" ( O"( Ñ" ; ( Æ" ï" ñ" b ( ºò" lô" {õ" + ôèY ±ëY ÉíY ðY ; ³óY #ýY b i Z Z Z + Ü¢Z >¥Z §Z ( ¨¨Z ( «Z( ¬Z ; ( ήZ [ {[ b ( þ[ à [ Ò |
+[ + $ ; Ç + ѵ ¸ Pº ( g» ( º½( U¿ ; ( [Á á Ý b ( Ç ã + ïÇÊ 0ÊÊ tÌÊ ( ÍÊ ( åÏÊ( fÑÊ ; ( YÓÊ §'Ë )Ë b ( Þ+Ë -Ë .Ë + Û® IÝ® }ß® ( à® ( öâ®( wä® ; ( hæ® :® <® b ( Ó>® @® A® + î:® Qð:® ò:® ( £ó:® ( öõ:®( w÷:® ; ( yù:® ÔM;® ÅO;® b ( lQ;® S;® .T;® + 7Fr® ÿHr® Kr® ÖMr® ; õPr® ¿[r® b _r® ¨`r® ·ar® + s® {s® Ás® ( ës® ( Js®( ë s® ; ( s® Aas® cs® b ( es® Çfs® Ögs® + /^ª® ; Ò`ª® + Ü«® !«® d«® ( «® ( Ü«®( w«® ; ( q«® )s«® -u«® b ( bw«® y«® )z«® + &ã® ê(ã® 3+ã® ( Z,ã® ( º.ã®( <0ã® ; ( -2ã® ã® ã® b ( Ìã® yã® ã® + 8¯ Ì:¯ =¯ ( >¯ ( {@¯( þA¯ ; ( óC¯ n¯ _¯ b ( ¢¯ Y¯ f¯ + ÜKS¯ NS¯ dPS¯ ( QS¯ ( ÓSS¯( UUS¯ ; ( FWS¯ ЫS¯ ÄS¯ b ( k¯S¯ ±S¯ ,²S¯ + 4¤¯ õ¦¯ +©¯ ᫯ ; ý®¯ ¹¯ b ȼ¯ k¾¯ z¿¯ + '^¯ `¯ Øb¯ ( ìc¯ ( Ef¯( ág¯ ; ( j¯ ¿¯ çÁ¯ b ( yï >ů MƯ + ¼Â¯ ; 3¿Â¯ + =qï ~sï ¼uï ( Óvï ( &yï( Ázï ; ( Ç|ï hÑï gÓï b ( Õï Q×ï mØÃ¯ + |û¯ ½ û¯ û¯ ( û¯ ( rû¯( óû¯ ; ( æû¯ [ãû¯ Låû¯ b ( çû¯ Féû¯ Uêû¯ + É3° ÷3° +3° ( C3° ( ¤3°( % 3° ; ( ¢3° ö3° tø3° b ( ·ú3° sü3° ý3° + ð©k° 1¬k° x®k° ( ¯k° ( Ö±k°( W³k° ; ( Yµk° å l° Öl° b ( } +l° 0l° ?l° + H£° £° £° Ò £° ; ñ£° Z£° b £° C£° R£° + ¼£° m¾£° ³À£° ( ÝÁ£° ( <Ä£°( ÝÅ£° ; ( êÇ£° ᤰ % ¤° b ( ¨!¤° g#¤° v$¤° + ÏÛ° ; rÛ° + |ÏÛ° ÁÑÛ° ÔÛ° ( )ÕÛ° ( |×Û°( ÙÛ° ; ( ÛÛ° å/ܰ æ1ܰ b ( 4ܰ Õ5ܰ â6ܰ + øá± 5ä± ~æ± ( ¥ç± ( ê±( ë± ; ( xí± èA± ÚC± b ( F± ÏG± ÞH± + VõK± ÷K± ÆùK± ( ÞúK± ( =ýK±( ¿þK± ; ( ´ L± EUL± 6WL± b ( yYL± 0[L± =\L± + H± ± б ( ì± ( ?±( Á± ; ( ²± <g± 0i± b ( ×j± l± m± + a»± Îc»± æe»± ¼h»± ; Úk»± Ku»± b x»± 4z»± C{»± + ¼± d¼± ´¼± ( È ¼± ( !#¼±( ½$¼± ; ( ê&¼± M|¼± ³~¼± b ( E¼± |
+¼± ¼± + \yó± ; ÿ{ó± + .ô± J0ô± 2ô± ( 3ô± ( ò5ô±( 7ô± ; ( 9ô± 4ô± 3ô± b ( hô± ô± 9ô± + H@,² B,² ÍD,² ( ÞE,² ( >H,²( ¿I,² ; ( ²K,² 2 ,² #¢,² b ( f¤,² ¦,² ,§,² + 5Rd² cTd² Vd² ( ¯Wd² ( Zd²( [d² ; ( ]d² î±d² à³d² b ( #¶d² Ù·d² æ¸d² + \e² g² äi² ( ïj² ( Bm²( Ãn² ; ( Åp² QŲ BDz b ( éȲ ʲ «Ë² + $¿Ó² áÁÓ² íÃÓ² ®ÆÓ² ; ÍÉÓ² 1ÓÓ² b wÖÓ² ØÓ² )ÙÓ² + öxÔ² S{Ô² }Ô² ( Ã~Ô² ( "Ô²( ÃÔ² ; ( éÔ² rÚÔ² ºÜÔ² b ( =ÞÔ² üßÔ² áÔ² + m׳ ; Ú³ + ¬³ ñ³ 4³ ( Y³ ( ¬³( G³ ; ( A³ $ë³ (í³ b ( ]ï³ ñ³ $ò³ + £D³ à D³ )£D³ ( P¤D³ ( °¦D³( 2¨D³ ; ( #ªD³ þD³ E³ b ( ÂE³ oE³ ~E³ + °|³ ²|³ ú´|³ ( ¶|³ ( q¸|³( ó¹|³ ; ( ä»|³ _}³ P}³ b ( }³ J}³ W}³ + Íô³ |
+Æ´³ UÈ´³ ( qÉ´³ ( ÄË´³( FÍ´³ ; ( ;Ï´³ Æ#µ³ º%µ³ b ( a'µ³ )µ³ "*µ³ + ì³ \ ì³ "ì³ V%ì³ ; t(ì³ ß1ì³ b %5ì³ È6ì³ ×7ì³ + -Öì³ Øì³ áÚì³ ( õÛì³ ( NÞì³( êßì³ ; ( âì³ 7í³ þ9í³ b ( ;í³ U=í³ d>í³ + 6$´ ; º8$´ + Té$´ ë$´ Óí$´ ( êî$´ ( =ñ$´( Øò$´ ; ( äô$´ I%´ K%´ b ( ¶M%´ kO%´ P%´ + û\´ Ôý\´ ]´ ( )]´ ( ]´( |
+]´ ; ( ý]´ }[]´ n]]´ b ( ±_]´ ha]´ wb]´ + ë´ ´ M´ ( e´ ( Ä´( E´ ; ( 8´ ¤n´ p´ b ( Ùr´ t´ u´ + "Í´ S$Í´ &Í´ ( ¥'Í´ ( ø)Í´( y+Í´ ; ( {-Í´ Í´ øÍ´ b ( Í´ RÍ´ aÍ´ + jzµ '}µ 3µ ôµ ; µ |µ b µ eµ tµ + ;4µ 6µ Õ8µ ( ÿ9µ ( ^<µ( ÿ=µ ; ( @µ µ õ b ( Fµ µ µ + m<µ ; <µ + G=µ eI=µ ¨K=µ ( ÍL=µ ( O=µ( »P=µ ; ( µR=µ §=µ ©=µ b ( ¿«=µ y=µ ®=µ + Yuµ Ù[uµ "^uµ ( I_uµ ( ©auµ( +cuµ ; ( euµ ¹uµ »uµ b ( ƽuµ x¿uµ Àuµ + ÿlµ 1oµ iqµ ( rµ ( àtµ( bvµ ; ( Wxµ é̵ Úε b ( ѵ ÔÒµ áÓµ + Wåµ åµ ßåµ ( û åµ ( Nåµ( Ðåµ ; ( Ååµ Pàåµ Dâåµ b ( ëãåµ ååµ ¬æåµ + ´Ø¶ qÛ¶ ݶ `à¶ ; ~ã¶ èì¶ b .ð¶ Ññ¶ àò¶ + §¶ ¶ X¶ ( l¶ ( Ŷ( a¶ ; ( ¶ åó¶ Jö¶ b ( Ü÷¶ ¡ù¶ °ú¶ + ôðT¶ ; óT¶ + ¡¥U¶ â§U¶ ªU¶ ( 7«U¶ ( U¶( %¯U¶ ; ( +±U¶ ÍV¶ ÉV¶ b ( þ V¶ ³V¶ ÏV¶ + Û·¶ º¶ `¼¶ ( q½¶ ( Ñ¿¶( RÁ¶ ; ( Eö Ŷ ¶¶ b ( ù¶ °¶ ¿¶ + 3ËŶ aÍŶ ÏŶ ( ÐŶ ( ÓŶ( ÔŶ ; ( ÖŶ ì*ƶ Þ,ƶ b ( !/ƶ ×0ƶ ä1ƶ + ZÞý¶ àý¶ ââý¶ ( íãý¶ ( @æý¶( Áçý¶ ; ( Ãéý¶ O>þ¶ @@þ¶ b ( çAþ¶ Cþ¶ ©Dþ¶ + ²65· o95· ;5· P>5· ; qA5· ÅJ5· b N5· ¨O5· ·P5· + ð5· öò5· <õ5· ( fö5· ( Åø5·( fú5· ; ( ü5· R6· GT6· b ( ÊU6· W6· X6· + òNm· ; Qm· + n· än· 'n· ( L n· ( n·( : +n· ; ( 4n· dn· fn· b ( Phn· |
+jn· kn· + +¦· h¦· ±¦· ( ئ· ( 8¦·( º¦· ; ( «!¦· v¦· x¦· b ( Jz¦· ÷{¦· }¦· + )Þ· µ+Þ· í-Þ· ( /Þ· ( d1Þ·( æ2Þ· ; ( ×4Þ· WÞ· HÞ· b ( Þ· BÞ· OÞ· + Z;¸ =¸ â?¸ ( þ@¸ ( QC¸( ÓD¸ ; ( ÄF¸ N¸ B¸ b ( é¸ ¸ ª¡¸ + #M¸ æM¸ þM¸ ÌM¸ ; ìM¸ #ªM¸ b iM¸ ¯M¸ °M¸ + ON¸ vQN¸ ÍSN¸ ( áTN¸ ( :WN¸( ÖXN¸ ; ( [N¸ °N¸ õ²N¸ b ( ´N¸ L¶N¸ [·N¸ + ¸ ; B° ¸ + Ü`¸ c¸ [e¸ ( rf¸ ( Åh¸( `j¸ ; ( fl¸ Á¸ ø b ( ;Ÿ ðÆ¸ È¸ + t¾¸ Çv¾¸ y¾¸ ( z¾¸ ( ||¾¸( ý}¾¸ ; ( 𾸠`Ô¾¸ QÖ¾¸ b ( ؾ¸ KÚ¾¸ ZÛ¾¸ + cö¸ ö¸ Åö¸ ( Ýö¸ ( >ö¸( ¿ö¸ ; ( °ö¸ æö¸ +èö¸ b ( Pêö¸ ìö¸ íö¸ + .¹ Ê.¹ .¹ ( .¹ ( o¡.¹( ð¢.¹ ; ( ò¤.¹ ~ù.¹ oû.¹ b ( ý.¹ Íþ.¹ Üÿ.¹ + Róe¹ öe¹ øe¹ Üúe¹ ; ûýe¹ df¹ b ª |
+f¹ Mf¹ \ +f¹ + #f¹ w¯f¹ ½±f¹ ( ç²f¹ ( Fµf¹( ç¶f¹ ; ( ð¸f¹ gg¹ «g¹ b ( .g¹ íg¹ üg¹ + U¹ ; ø +¹ + À¹ G¹ Ĺ ( ¯Å¹ ( ȹ( ɹ ; ( ˹ k ¹ l"¹ b ( ¡$¹ [&¹ h'¹ + ~ÒÖ¹ »ÔÖ¹ ×Ö¹ ( +ØÖ¹ ( ÚÖ¹( +ÜÖ¹ ; ( þÝÖ¹ n2×¹ `4×¹ b ( £6×¹ U8×¹ d9×¹ + qäº £æº Ûèº ( óéº ( Rìº( Ôíº ; ( Éïº [Dº LFº b ( Hº FJº SKº + É÷Fº úFº QüFº ( mýFº ( ÀÿFº( BGº ; ( 7Gº ÂWGº ¶YGº b ( ][Gº ]Gº ^Gº + Q~º TT~º lV~º 9Y~º ; U\~º ¿e~º b i~º ¨j~º ·k~º + |
+º oº ƺ ( Úº ( 3º( Ϻ ; ( º Wkº ¼mº b ( Noº qº "rº + ×i¶º ; zl¶º + ·º T·º !·º ( ©"·º ( ü$·º( &·º ; ( (·º ?}·º ;·º b ( p·º %·º A·º + ¸0ïº ù2ïº =5ïº ( N6ïº ( ®8ïº( /:ïº ; ( "<ïº ¢ïº ïº b ( Öïº ïº ïº + ¥B'» ÓD'» G'» ( H'» ( J'»( L'» ; ( òM'» ^¢'» P¤'» b ( ¦'» E¨'» R©'» + ÌU_» +X_» TZ_» ( _[_» ( ²]_»( 3__» ; ( 5a_» Áµ_» ²·_» b ( Y¹_» »_» ¼_» + ¯» U²» u´» 6·» ; Yº» ¼Ã» b Ç» ¥È» ´É» + h» nj» ´l» ( Þm» ( =p»( Þq» ; ( t» É» ÊË» b ( MÍ» Ï» л + åÇλ ; Êλ + !{Ï» f}Ï» ©Ï» ( ÎÏ» ( !Ï»( ¼Ï» ; ( ¶Ï» ÛÏ» £ÝÏ» b ( ØßÏ» áÏ» âÏ» + ³¼ ð¼ 9¼ ( `¼ ( À¼( B¼ ; ( 3¼ í¼ ï¼ b ( Øñ¼ ó¼ ô¼ + ¡?¼ C£?¼ {¥?¼ ( ¦?¼ ( ò¨?¼( tª?¼ ; ( i¬?¼ å @¼ Ö@¼ b ( @¼ Ð@¼ Ý@¼ + S´w¼ ¶w¼ Û¸w¼ ( ÷¹w¼ ( J¼w¼( ̽w¼ ; ( Á¿w¼ Lx¼ @x¼ b ( çx¼ x¼ ¨x¼ + °¯¼ m¯¼ ¯¼ R¯¼ ; n¯¼ ä ¯¼ b *$¯¼ Í%¯¼ Ü&¯¼ + Ư¼ ùȯ¼ P˯¼ ( d̯¼ ( ½Î¯¼( YЯ¼ ; ( Ò¯¼ (°¼ g*°¼ b ( ù+°¼ ¾-°¼ Í.°¼ + %ç¼ ; ´'ç¼ + ¾Ùç¼ ÿÛç¼ =Þç¼ ( Tßç¼ ( §áç¼( Bãç¼ ; ( Håç¼ ê9è¼ æ;è¼ b ( >è¼ Ð?è¼ ì@è¼ + øë½ 9î½ }ð½ ( ñ½ ( îó½( oõ½ ; ( b÷½ ÒK ½ ÃM ½ b ( P ½ ¾Q ½ ÍR ½ + @ÿW½ nX½ ¢X½ ( ºX½ ( X½( X½ ; ( |
+X½ ø^X½ ê`X½ b ( -cX½ ãdX½ ðeX½ + f½ §½ î½ ( ù½ ( L½( ͽ ; ( Ͻ [r½ St½ b ( úu½ ²w½ Áx½ + Äjǽ mǽ oǽ Xrǽ ; wuǽ á~ǽ b 'ǽ Êǽ Ùǽ + $Ƚ ô&Ƚ :)Ƚ ( d*Ƚ ( Ã,Ƚ( d.Ƚ ; ( m0Ƚ ä Ƚ (Ƚ b ( «È½ jȽ yȽ + Òÿ½ ; u ÿ½ + 7 ¾ Ä9 ¾ < |