diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-03 00:13:46 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-03 00:13:46 +0000 |
commit | ef91aac6887e82b77ca3dff8bcffaffab0a8ec08 (patch) | |
tree | 6f6db2314ca66fe045b4df3aec7f60464f2bece7 | |
parent | a6d3594d395a61cfab97a69ebcf85bff71875f2f (diff) |
Add profiling. Also some trivial optimisations to skip memcpying.
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | TODO | 8 | ||||
-rw-r--r-- | input.c | 17 |
3 files changed, 28 insertions, 7 deletions
@@ -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/} @@ -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 @@ -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); } |