7 public class Tracer extends Applet implements Runnable,CbButtonCallback
10 StringBuffer logbuffer = new StringBuffer();
13 CbButton pause, button;
14 boolean paused = false;
16 Vector buffer = new Vector();
21 setLayout(new BorderLayout());
22 String cols[] = { "Time", "System Call", "Parameters", "Return" };
23 add("Center", log = new MultiColumn(cols));
24 float widths[] = { .1f, .15f, .65f, .1f };
25 log.setWidths(widths);
26 Util.setFont(new Font("TimesRoman", Font.PLAIN, 12));
27 Panel bot = new Panel();
28 bot.setBackground(Color.white);
29 bot.setForeground(Color.white);
30 bot.setLayout(new FlowLayout(FlowLayout.RIGHT));
31 bot.add(pause = new CbButton(" Pause ", this));
37 // Start download thread
39 th = new Thread(this);
47 String killurl = getParameter("killurl");
48 if (killurl != null) {
49 // Call this CGI at stop time
51 URL u = new URL(getDocumentBase(), killurl);
52 URLConnection uc = u.openConnection();
53 String session = getParameter("session");
55 uc.setRequestProperty("Cookie", session);
56 uc.getInputStream().close();
58 catch(Exception e2) { }
60 if (is != null) is.close();
61 if (th != null) th.stop();
72 URL u = new URL(getDocumentBase(), getParameter("url"));
73 URLConnection uc = u.openConnection();
74 String session = getParameter("session");
76 uc.setRequestProperty("Cookie", session);
77 is = new LineInputStream(uc.getInputStream());
80 new StringSplitter(is.gets(), '\t', false);
81 if (tok.countTokens() == 4) {
82 Object row[] = { tok.nextToken(),
87 // Store in temp buffer
88 buffer.addElement(row);
89 if (buffer.size() > MAX_ROWS) {
90 buffer.removeElementAt(0);
97 log.scrollto(log.count()-1);
102 catch(EOFException e) {
105 catch(IOException e) {
113 while(log.count() > MAX_ROWS) {
118 public void click(CbButton b) {
121 // Resume display, and add missed stuff
122 pause.setText(" Pause ");
123 for(int i=0; i<buffer.size(); i++) {
125 (Object[])buffer.elementAt(i);
129 log.scrollto(log.count()-1);
130 buffer.removeAllElements();
133 pause.setText("Resume");