OK, turing.

<- leave blank

Fri Apr 16 18:42:08 EDT 2021

Fri Apr 16 22:41:27 GMT 2021

Environment:
user = glenda
sysname = gondor
bootfile = 9pc64
service = terminal
monitor = vesa
vgasize = 1366x768x32

window rect = [96 68] [796 768]
window size = [700 700]
screen->chan = x8r8g8b8

whiteflags: 5
blackflags: 5
redflags: 21
aredflags: 29
part 1: direct screen

libdraw base flushimage time
n cycles: 100 times
max time: 1 μs
min time: 0 μs
avg time: 0 μs

libdraw GREY1 fill
n cycles: 100 times
max time: 1812 μs
min time: 884 μs
avg time: 1245 μs

libdraw RGB24 fill
n cycles: 100 times
max time: 1850 μs
min time: 865 μs
avg time: 1254 μs

libdraw RGBA32 fill
n cycles: 100 times
max time: 1850 μs
min time: 865 μs
avg time: 1312 μs

libdraw RGB24 draw
n cycles: 100 times
max time: 8826 μs
min time: 4087 μs
avg time: 5934 μs

libdraw RGB24 draw gradient mask
n cycles: 100 times
max time: 33410 μs
min time: 12719 μs
avg time: 22063 μs

libdraw RGBA32 draw
n cycles: 100 times
max time: 31795 μs
min time: 29860 μs
avg time: 31413 μs

part 2: back buffer

libdraw base flushimage time
n cycles: 100 times
max time: 1 μs
min time: 0 μs
avg time: 0 μs

libdraw GREY1 fill
n cycles: 100 times
max time: 1383 μs
min time: 957 μs
avg time: 1030 μs

libdraw RGB24 fill
n cycles: 100 times
max time: 1086 μs
min time: 978 μs
avg time: 1027 μs

libdraw RGBA32 fill
n cycles: 100 times
max time: 1084 μs
min time: 996 μs
avg time: 1027 μs

libdraw RGB24 draw
n cycles: 100 times
max time: 8092 μs
min time: 3691 μs
avg time: 6042 μs

libdraw RGB24 draw gradient mask
n cycles: 100 times
max time: 27013 μs
min time: 12319 μs
avg time: 21188 μs

libdraw RGBA32 draw
n cycles: 100 times
max time: 30369 μs
min time: 13854 μs
avg time: 23462 μs

part 3: memdraw

memdraw GREY1 fill
n cycles: 100 times
max time: 2617 μs
min time: 996 μs
avg time: 1038 μs

memdraw RGB24 fill
n cycles: 100 times
max time: 1095 μs
min time: 591 μs
avg time: 1020 μs

memdraw RGBA32 fill
n cycles: 100 times
max time: 1086 μs
min time: 938 μs
avg time: 1020 μs

memdraw RGB24 draw
n cycles: 100 times
max time: 12840 μs
min time: 7894 μs
avg time: 8076 μs

memdraw RGB24 draw gradient mask
n cycles: 100 times
max time: 26448 μs
min time: 23856 μs
avg time: 26268 μs

memdraw RGBA32 draw
n cycles: 100 times
max time: 29801 μs
min time: 26939 μs
avg time: 29546 μs



Fri Apr 16 09:58:40 EDT 2021
In [1]: import math

In [2]: def stuff(rgb):
   ...: return math.sqrt(rgb[0] + rgb[1] + rgb[2])
   ...:

In [3]: a = [9,9,9, 1,1,1, 3,3,3]

In [4]: i = iter(a)

In [5]: b = list(zip(i,i,i)); b.sort(key=stuff)

In [6]: b
Out[6]: [(1, 1, 1), (3, 3, 3), (9, 9, 9)]


Thu Apr 15 17:25:36 EDT 2021
abort()+0x0 /sys/src/libc/9sys/abort.c:6
error(s=0x4b48c)+0x33 /sys/src/cmd/acme/util.c:55
diskwrite(bp=0xb0e1c,n=0xf57,d=0x73198,r=0xa8c08)+0xbc
/sys/src/cmd/acme/disk.c:120
	b=0x8b4d4
	size=0x4000
flush(b=0x9dc20)+0x68 /sys/src/cmd/acme/buff.c:71
setcache(q0=0x14db6,b=0x9dc20)+0x62 /sys/src/cmd/acme/buff.c:94
	q=0xa0d30
	blp=0x9e0e0
	i=0x1efe4
	bl=0x3ea92
bufread(b=0x9dc20,q0=0x14db6,n=0x7d0,s=0x9e0e0)+0x48 /sys/src/cmd/acme/buff.c:288
	m=0x9e0e0
textfill(t=0x9d8b4)+0xa1 /sys/src/cmd/acme/text.c:412
	rp=0x9e0e0
	n=0x7d0
textredraw(t=0x9d8b4,r=0x14,f=0x739d8,b=0x7bb58,odx=0x313)+0x11f
/sys/src/cmd/acme/text.c:65
	rr=0x4
	maxt=0x4
textresize(t=0x9d8b4,r=0x14)+0xe1 /sys/src/cmd/acme/text.c:87
	odx=0x313
winresize(w=0x9d7c0,r=0x4,safe=0x1)+0x2f9 /sys/src/cmd/acme/wind.c:237
	mouseintag=0x0
	mouseinbody=0x1
	r1=0x4
	y=0x8a
	br=0x4
	p=0x93010
	oy=0x8a
winsettag1(w=0x9d7c0)+0x625 /sys/src/cmd/acme/wind.c:542
	old=0xa08c0
	i=0x3e
	new=0xa11a0
	k=0x3a
	q0=0x47
	q1=0x47
	j=0x39
	bar=0x39
	br=0x4
winsettag(w=0x9d7c0)+0x64 /sys/src/cmd/acme/wind.c:556
	f=0x9dc20
	i=0x0
wintype(t=0x9d8b4,r=0x8,w=0x9d7c0)+0x85 /sys/src/cmd/acme/wind.c:403
	i=0x0
rowtype(row=0x4db7c,p=0x228,r=0x8)+0xcc /sys/src/cmd/acme/rows.c:274
	t=0x9d8b4
	w=0x9d7c0
keyboardthread()+0xb0 /sys/src/cmd/acme/acme.c:403
	r=0x8
	timer=0x0
	t=0x9d8b4
launcher386(arg=0x0,f=0x20bc)+0x10 /sys/src/libthread/386.c:10
0xfefefefe ?file?:0


Thu Apr 15 17:25:30 EDT 2021
abort()+0x0 /sys/src/libc/9sys/abort.c:6
error(s=0x4b48c)+0x33 /sys/src/cmd/acme/util.c:55
diskwrite(bp=0x5fe48,n=0x1ffc,d=0x73138,r=0xa8c08)+0xbc
/sys/src/cmd/acme/disk.c:120
	b=0x8b33c
	size=0x8000
flush(b=0x9dba0)+0x68 /sys/src/cmd/acme/buff.c:71
bufinsert(b=0x9dba0,q0=0x1ffc,n=0x2000,s=0xa0340)+0x256
/sys/src/cmd/acme/buff.c:155
	off=0x1ffc
	t=0x1ffc
	m=0x1ffc
	i=0x39341
bufloader(v=0x9dba0,q0=0x1ffc,r=0xa0340,nr=0x2000)+0x27
/sys/src/cmd/acme/buff.c:230
loadfile(q0=0x0,fd=0x12,nulls=0x95124,arg=0x9dba0,f=0x4f8d)+0x13d
/sys/src/cmd/acme/buff.c:264
	p=0x9e060
	r=0xa0340
	m=0x4
	q1=0x1ffc
	n=0x2000
	nb=0x2000
	nr=0x2000
bufload(b=0x9dba0,q0=0x0,fd=0x12,nulls=0x95124)+0x49 /sys/src/cmd/acme/buff.c:276
fileload(f=0x9dba0,p0=0x0,fd=0x12,nulls=0x95124)+0x43 /sys/src/cmd/acme/file.c:170
textload(t=0x9d834,file=0x9d620,q0=0x0,setqid=0x1)+0x60a
/sys/src/cmd/acme/text.c:252
	fd=0x12
	nulls=0x0
	d=0xa0260
	rp=0x9d834
	dlp=0x0
	ndl=0x9d680
	dbuf=0x9d680
	n=0x29
	i=0x734d8
	dl=0x9d740
	j=0x7
	tmp=0x9dd40
	q1=0x0
	q=0x205b5
	u=0x1140c
openfile(t=0x9d834,e=0x951cc)+0x2a8 /sys/src/cmd/acme/look.c:655
	w=0x9d740
	ow=0x0
	i=0x0
	n=0x951a0
	rp=0x951a4
	eval=0x5cbfc
	r=0x0
	dummy=0x75d98
plumblook(m=0x9d560)+0xe4 /sys/src/cmd/acme/look.c:196
	e=0x0
mousethread()+0x19d /sys/src/cmd/acme/acme.c:478
	pm=0x9d560
	act=0xfefefefe
	m=0xfefefefe
	t=0xfefefefe
	w=0xfefefefe
	but=0xfefefefe
	q0=0xfefefefe
	q1=0xfefefefe
	argt=0xfefefefe
launcher386(arg=0x0,f=0x2339)+0x10 /sys/src/libthread/386.c:10
0xfefefefe ?file?:0


Thu Apr 15 09:24:12 EDT 2021
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <libsec.h>
#include <authsrv.h>
#include "authcmdlib.h"

void install(char*, char*, Authkey*, long, int);
int exists(char*, char*);

void
usage(void)
{
	fprint(2, "usage: batchuser -u username -p password [-e email] [-n
	realname]\n");
	exits("usage");
}

char *username;
char *password;
char *email = "";
char *realname = "";

void
main(int argc, char **argv)
{
	Authkey key;
	Acctbio a;
	Fs *f;
	char *err;
	long t = 0;

	ARGBEGIN{
	case 'u':
		username = EARGF(usage());
		break;
	case 'p':
		password = EARGF(usage());
		break;
	case 'e':
		email = EARGF(usage());
		break;
	case 'n':
		realname = EARGF(usage());
		break;
	}ARGEND

	if (username == nil && password == nil) {
		usage();
	}

	if (username == nil || password == nil) {
		fprint(2, "no username or password given.");
		exits("usage");
	}

	memset(&key, 0, sizeof(key));
	f = &fs[Plan9];
	if (exists(f->keys, username)) {
		fprint(2, "user already exists.\n");
		exits("user already exists");
	}
	if (err = okpasswd(password)) {
		fprint(2, "%s.\n", err);
		exits("okpasswd failed.");
	}
	if (strlen(password) >= PASSWDLEN) {
		fprint(2, "password too long.\n");
		exits("password too long");
	}
	passtokey(&key, password);
	install(f->keys, username, &key, t, 1);
	setsecret(KEYDB, username, password);

	rdbio(f->who, username, &a);
	a.postid = nil;
	a.name = realname;
	a.dept = "";
	a.email[0] = email;
	a.email[1] = nil;
	wrbio(f->who, &a);
	syslog(0, AUTHLOG, "user %s installed for plan 9 (batch mode)", username);
}

void
install(char *db, char *u, Authkey *key, long t, int newkey)
{
	char buf[KEYDBBUF+ANAMELEN+20];
	int fd;

	if(!exists(db, u)){
		snprint(buf, sizeof(buf), "%s/%s", db, u);
		fd = create(buf, OREAD, 0777|DMDIR);
		if(fd < 0)
			error("can't create user %s: %r", u);
		close(fd);
	}

	if(newkey && !setkey(db, u, key))
		error("can't set key: %r");

	if(t == -1)
		return;
	snprint(buf, sizeof(buf), "%s/%s/expire", db, u);
	fd = open(buf, OWRITE);
	if(fd < 0 || fprint(fd, "%ld", t) < 0)
		error("can't write expiration time");
	close(fd);
}

int
exists(char *db, char *u)
{
	char buf[KEYDBBUF+ANAMELEN+6];

	snprint(buf, sizeof(buf), "%s/%s/expire", db, u);
	if(access(buf, 0) < 0)
		return 0;
	return 1;
}


Wed Apr 14 22:17:13 EDT 2021
2020-04-17
using libmemdraw routines only
/usr/bird/src/drawbench% prof 6.drawbench prof.RGB24 | sed 10q
  % Time Calls Name
45.9 0.902 346000 writebyte
29.7 0.584 346000 genconv
 7.7 0.151 346023 memsetl
 5.5 0.108 346000 readbyte
 4.0 0.078 500 alphadraw
 2.6 0.051 346723 memmove
 1.1 0.022 346000 boolmemmove
 0.8 0.015 1038000 clipy
 0.6 0.011 346000 replread
/usr/bird/src/drawbench% prof 6.drawbench prof.RGB24grad | sed 10q
  % Time Calls Name
50.4 2.959 346000 alphacalcS
28.5 1.674 692500 readbyte
15.5 0.912 346000 writebyte
 2.5 0.149 346023 memsetl
 1.4 0.085 500 alphadraw
 0.3 0.015 346000 greymaskread
 0.2 0.014 1038000 clipy
 0.2 0.014 29 write
 0.2 0.012 347516 memset
/usr/bird/src/drawbench% prof 6.drawbench prof.RGBA32 | sed 10q
  % Time Calls Name
54.1 3.491 346000 alphacalc11
27.2 1.753 692000 readbyte
14.0 0.906 346000 writebyte
 2.3 0.151 346023 memsetl
 1.2 0.079 500 alphadraw
 0.2 0.015 1038000 clipy
 0.2 0.011 29 write
 0.2 0.011 347516 memset
 0.2 0.011 346000 replread
/usr/bird/src/drawbench% prof 6.drawbench prof.all | sed 10q
  % Time Calls Name
23.2 3.526 1730500 readbyte
23.0 3.501 346000 alphacalc11
19.6 2.973 346000 alphacalcS
17.9 2.722 1038000 writebyte
 8.8 1.341 3114023 memsetl
 3.9 0.589 346000 genconv
 1.5 0.225 1500 alphadraw
 0.3 0.051 6003 memoptdraw
 0.3 0.046 346723 memmove


Wed Apr 14 22:13:25 EDT 2021
/sys/src/libmemdraw/draw.c:374,380 - draw.c:374,380
	uchar *alpha; /* is &ones when unused, never nil */
	uchar *grey;
	ulong *rgba;
- int delta; /* number of bytes to add to pointer to get next pixel to the right
*/
+ uintptr delta; /* number of bytes to add to pointer to get next pixel to the
right */

	/* used by boolcalc* for mask data */
	uchar *m; /* ptr to mask data r.min byte; like p->bytermin */


Wed Apr 14 22:06:00 EDT 2021
alphacalcS+0x1f6 0x00000000002142c8 ADDQ R8,bsrc+0x70(FP)
alphacalcS+0x1fe 0x00000000002142d0 ADDQ R8,0x80(FP)
alphacalcS+0x206 0x00000000002142d8 ADDQ R8,0x78(FP)
alphacalcS+0x20e 0x00000000002142e0 ADDQ BP,bdst+0x8(FP)
alphacalcS+0x216 0x00000000002142e8 ADDQ BP,0x18(FP)
alphacalcS+0x21e 0x00000000002142f0 ADDQ BP,0x10(FP)


Wed Apr 14 22:00:33 EDT 2021
/sys/src/libmemdraw/draw.c:374,380 - draw.c:374,380
	uchar *alpha; /* is &ones when unused, never nil */
	uchar *grey;
	ulong *rgba;
- int delta; /* number of bytes to add to pointer to get next pixel to the right
*/
+ uintptr delta; /* number of bytes to add to pointer to get next pixel to the
right */

	/* used by boolcalc* for mask data */
	uchar *m; /* ptr to mask data r.min byte; like p->bytermin */
/sys/src/libmemdraw/draw.c:1068,1073 - draw.c:1068,1078
	int fd;
	int i, ma;
	ulong t;
+
+ uintptr sd;
+ uintptr dd;
+ sd = bsrc.delta;
+ dd = bdst.delta;

	USED(op);
	obdst = bdst;
/sys/src/libmemdraw/draw.c:1084,1095 - draw.c:1089,1100
			*bdst.red = CALC12(ma, *bsrc.red, fd, *bdst.red, t);
			*bdst.grn = CALC12(ma, *bsrc.grn, fd, *bdst.grn, t);
			*bdst.blu = CALC12(ma, *bsrc.blu, fd, *bdst.blu, t);
- bsrc.red += bsrc.delta;
- bsrc.blu += bsrc.delta;
- bsrc.grn += bsrc.delta;
- bdst.red += bdst.delta;
- bdst.blu += bdst.delta;
- bdst.grn += bdst.delta;
+ bsrc.red += sd;
+ bsrc.blu += sd;
+ bsrc.grn += sd;
+ bdst.red += dd;
+ bdst.blu += dd;
+ bdst.grn += dd;
		}
		if(bdst.alpha != &ones){
			*bdst.alpha = ma+CALC11(fd, *bdst.alpha, t);


Wed Apr 14 21:23:01 EDT 2021
/sys/src/libmemdraw/draw.c:374,380 - draw.c:374,380
	uchar *alpha; /* is &ones when unused, never nil */
	uchar *grey;
	ulong *rgba;
- int delta; /* number of bytes to add to pointer to get next pixel to the right
*/
+ uintptr delta; /* number of bytes to add to pointer to get next pixel to the
right */

	/* used by boolcalc* for mask data */
	uchar *m; /* ptr to mask data r.min byte; like p->bytermin */
/sys/src/libmemdraw/draw.c:1068,1101 - draw.c:1068,1120
	int fd;
	int i, ma;
	ulong t;
-
- USED(op);
+
+ uintptr ds, dd, dm;
+ uchar *sred, *sgrn, *sblu;
+ uchar *dred, *dgrn, *dblu;
+ uchar *malpha;
+
	obdst = bdst;
+
+ ds = bsrc.delta;
+ dd = bdst.delta;
+ dm = bmask.delta;
+
+ sred = bsrc.red;
+ sgrn = bsrc.grn;
+ sblu = bsrc.blu;
+ dred = bdst.red;
+ dgrn = bdst.grn;
+ dblu = bdst.blu;
+
+ malpha = bmask.alpha;

+ USED(op);
	for(i=0; i<dx; i++){
- ma = *bmask.alpha;
+ ma = *malpha;
		fd = 255-ma;
+ malpha += dm;

		if(grey){
			*bdst.grey = CALC12(ma, *bsrc.grey, fd, *bdst.grey, t);
- bsrc.grey += bsrc.delta;
- bdst.grey += bdst.delta;
+ bsrc.grey += ds;
+ bsrc.grey += dd;
		}else{
- *bdst.red = CALC12(ma, *bsrc.red, fd, *bdst.red, t);
- *bdst.grn = CALC12(ma, *bsrc.grn, fd, *bdst.grn, t);
- *bdst.blu = CALC12(ma, *bsrc.blu, fd, *bdst.blu, t);
- bsrc.red += bsrc.delta;
- bsrc.blu += bsrc.delta;
- bsrc.grn += bsrc.delta;
- bdst.red += bdst.delta;
- bdst.blu += bdst.delta;
- bdst.grn += bdst.delta;
+ *dred = CALC12(ma, *sred, fd, *dred, t);
+ *dgrn = CALC12(ma, *sgrn, fd, *dgrn, t);
+ *dblu = CALC12(ma, *sblu, fd, *dblu, t);
+
+ sred += ds;
+ sgrn += ds;
+ sblu += ds;
+ dred += dd;
+ dgrn += dd;
+ dblu += dd;
		}
		if(bdst.alpha != &ones){
			*bdst.alpha = ma+CALC11(fd, *bdst.alpha, t);
- bdst.alpha += bdst.delta;
+ bdst.alpha += dd;
		}
- bmask.alpha += bmask.delta;
	}
	return obdst;
  }


Wed Apr 14 21:15:49 EDT 2021
alphacalcS+0x224 0x0000000000214339 MOVL 0x38(FP),DI
alphacalcS+0x22b 0x0000000000214340 MOVLQSX DI,DI
alphacalcS+0x22e 0x0000000000214343 ADDQ DI,bdst+0x8(FP)
alphacalcS+0x236 0x000000000021434b MOVL 0x38(FP),DI
alphacalcS+0x23d 0x0000000000214352 MOVLQSX DI,DI
alphacalcS+0x240 0x0000000000214355 ADDQ DI,0x18(FP)
alphacalcS+0x248 0x000000000021435d MOVL 0x38(FP),DI
alphacalcS+0x24f 0x0000000000214364 MOVLQSX DI,DI
alphacalcS+0x252 0x0000000000214367 ADDQ DI,0x10(FP)


prev | next