summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 00:13:46 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 00:13:46 +0000
commitef91aac6887e82b77ca3dff8bcffaffab0a8ec08 (patch)
tree6f6db2314ca66fe045b4df3aec7f60464f2bece7
parenta6d3594d395a61cfab97a69ebcf85bff71875f2f (diff)
Add profiling. Also some trivial optimisations to skip memcpying.
-rw-r--r--Makefile10
-rw-r--r--TODO8
-rw-r--r--input.c17
3 files changed, 28 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 0e8ed49a..d953f085 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.9 2007-10-01 14:53:29 nicm Exp $
+# $Id: Makefile,v 1.10 2007-10-03 00:13:46 nicm Exp $
.SUFFIXES: .c .o .y .h
.PHONY: clean
@@ -25,6 +25,11 @@ YACC= yacc -d
CC= cc
INCDIRS+= -I. -I- -I/usr/local/include
CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\"" -DMETA="'${META}'"
+.ifdef PROFILE
+# Don't use ccache
+CC= /usr/bin/gcc
+CFLAGS+= -pg -DPROFILE -O0
+.endif
.ifdef DEBUG
CFLAGS+= -g -ggdb -DDEBUG
LDFLAGS+= -Wl,-E
@@ -40,6 +45,9 @@ INSTALLBIN= install -g bin -o root -m 555
INSTALLMAN= install -g bin -o root -m 444
LDFLAGS+= -L/usr/local/lib
+.ifdef PROFILE
+LDFLAGS+= -pg
+.endif
LIBS+= -lutil -lncurses
OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}
diff --git a/TODO b/TODO
index 972504bd..1f0e1057 100644
--- a/TODO
+++ b/TODO
@@ -10,7 +10,6 @@
- scrollback
- server doesn't handle SIGTERM anymore...
- copy/paste
-- cleanup/redesign IPC
- the whole input/screen/local thing sucks a bit, reorganise/redesign it
- line mode/char-at-a-time mode a la telnet?
- some of the uses of buffers really sucks. buffer_reverse_add/remove,
@@ -30,6 +29,10 @@
or use queues/trees and avoid NULLs?
- client could pass tty fd up to server and then do nothing. what problems
would this cause?
+- cleanup/redesign IPC
+ IPC is arse-about-face: too much overhead. 8-byte header for each
+ packet... hrm. already scanning output for \e, could add an extra
+ byte to it for message
-- For 0.1 --------------------------------------------------------------------
- man page
@@ -43,6 +46,9 @@
close window
kill session
set status on/off
+ set meta
+ set shell
+ bind key??
- fix resize (width problems with multiple clients?)
- handle tmux in tmux (check $TMUX and abort)
- check for some reqd terminfo caps on startup
diff --git a/input.c b/input.c
index b82eae2c..3f3d7f9c 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* $Id: input.c,v 1.16 2007-10-01 17:37:41 nicm Exp $ */
+/* $Id: input.c,v 1.17 2007-10-03 00:13:46 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1107,13 +1107,18 @@ input_store_two(struct buffer *b, u_char code, uint16_t ua, uint16_t ub)
void
input_store8(struct buffer *b, uint8_t n)
{
- buffer_write(b, &n, sizeof n);
+ buffer_ensure(b, 1);
+ BUFFER_IN(b)[0] = n;
+ buffer_add(b, 1);
}
void
input_store16(struct buffer *b, uint16_t n)
{
- buffer_write(b, &n, sizeof n);
+ buffer_ensure(b, 2);
+ BUFFER_IN(b)[0] = n & 0xff;
+ BUFFER_IN(b)[1] = n >> 8;
+ buffer_add(b, 2);
}
uint8_t
@@ -1121,7 +1126,8 @@ input_extract8(struct buffer *b)
{
uint8_t n;
- buffer_read(b, &n, sizeof n);
+ n = BUFFER_OUT(b)[0];
+ buffer_remove(b, 1);
return (n);
}
@@ -1130,6 +1136,7 @@ input_extract16(struct buffer *b)
{
uint16_t n;
- buffer_read(b, &n, sizeof n);
+ n = BUFFER_OUT(b)[0] | (BUFFER_OUT(b)[1] << 8);
+ buffer_remove(b, 2);
return (n);
}