summaryrefslogtreecommitdiff
path: root/xdelta3
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3')
-rwxr-xr-xxdelta3/Makefile3
-rwxr-xr-xxdelta3/setup.py2
-rwxr-xr-xxdelta3/xdelta3-main.h5
-rwxr-xr-xxdelta3/xdelta3-regtest.py78
-rwxr-xr-xxdelta3/xdelta3.prj2
5 files changed, 76 insertions, 14 deletions
diff --git a/xdelta3/Makefile b/xdelta3/Makefile
index 1bb4664..968ab15 100755
--- a/xdelta3/Makefile
+++ b/xdelta3/Makefile
@@ -30,7 +30,7 @@ EXTRA = Makefile COPYING linkxd3lib.c badcopy.c www \
30 draft-korn-vcdiff.txt xdelta3.vcproj badcopy.vcproj 30 draft-korn-vcdiff.txt xdelta3.vcproj badcopy.vcproj
31 31
32# $Format: "REL=$Xdelta3Version$" $ 32# $Format: "REL=$Xdelta3Version$" $
33REL=0j 33REL=0k
34RELDIR = xdelta3$(REL) 34RELDIR = xdelta3$(REL)
35 35
36all: xdelta3-debug xdelta3 $(PYTGT) 36all: xdelta3-debug xdelta3 $(PYTGT)
@@ -50,6 +50,7 @@ tar:
50 50
51clean: 51clean:
52 rm -f $(TARGETS) 52 rm -f $(TARGETS)
53 rm -rf build Debug Release
53 54
54xdelta3: $(SOURCES) 55xdelta3: $(SOURCES)
55 $(CC) -O3 -Wall -Wshadow xdelta3.c -lm -o xdelta3 \ 56 $(CC) -O3 -Wall -Wshadow xdelta3.c -lm -o xdelta3 \
diff --git a/xdelta3/setup.py b/xdelta3/setup.py
index 8691bfb..ffde8ad 100755
--- a/xdelta3/setup.py
+++ b/xdelta3/setup.py
@@ -33,7 +33,7 @@ xdelta3_ext = Extension('xdelta3',
33 ]) 33 ])
34 34
35# $Format: "REL='$Xdelta3Version$'" $ 35# $Format: "REL='$Xdelta3Version$'" $
36REL='0j' 36REL='0k'
37 37
38setup(name='xdelta3', 38setup(name='xdelta3',
39 version=REL, 39 version=REL,
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 06190d0..e80b332 100755
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -84,7 +84,7 @@ const char* xd3_mainerror(int err_num);
84#define PRINTHDR_SPECIAL -4378291 84#define PRINTHDR_SPECIAL -4378291
85 85
86/* The number of soft-config variables. */ 86/* The number of soft-config variables. */
87#define XD3_SOFTCFG_VARCNT 1 87#define XD3_SOFTCFG_VARCNT 10
88 88
89/* this is used as in XPR(NT XD3_LIB_ERRMSG (stream, ret)) to print an error message 89/* this is used as in XPR(NT XD3_LIB_ERRMSG (stream, ret)) to print an error message
90 * from the library. */ 90 * from the library. */
@@ -2278,7 +2278,8 @@ main_input (xd3_cmd cmd,
2278 (got < XD3_SOFTCFG_VARCNT-1 && *e == 0) || 2278 (got < XD3_SOFTCFG_VARCNT-1 && *e == 0) ||
2279 (got == XD3_SOFTCFG_VARCNT-1 && *e != 0)) 2279 (got == XD3_SOFTCFG_VARCNT-1 && *e != 0))
2280 { 2280 {
2281 XPR(NT "invalid string match specifier (-C)\n"); 2281 XPR(NT "invalid string match specifier (-C) %d: %s\n",
2282 got, s);
2282 return EXIT_FAILURE; 2283 return EXIT_FAILURE;
2283 } 2284 }
2284 } 2285 }
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index 536c086..4cb3a35 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -21,7 +21,7 @@
21# TODO: This is really part test, part performance evaluation suite, and 21# TODO: This is really part test, part performance evaluation suite, and
22# really incomplete. 22# really incomplete.
23 23
24import os, sys, math, re, time, types, array 24import os, sys, math, re, time, types, array, random
25import xdelta3 25import xdelta3
26 26
27HIST_SIZE = 10 # the number of buckets 27HIST_SIZE = 10 # the number of buckets
@@ -31,7 +31,7 @@ TIME_TOO_SHORT = 0.050
31 31
32MIN_REPS = 1 32MIN_REPS = 1
33MAX_REPS = 1 33MAX_REPS = 1
34SKIP_TRIALS = 1 34SKIP_TRIALS = 2
35MIN_TRIALS = 3 35MIN_TRIALS = 3
36MAX_TRIALS = 15 36MAX_TRIALS = 15
37 37
@@ -216,6 +216,15 @@ class RcsFile:
216 os.remove(self.Verf(self.totrev-1)) 216 os.remove(self.Verf(self.totrev-1))
217 os.remove(self.Verf(self.totrev-2)) 217 os.remove(self.Verf(self.totrev-2))
218 return ntrials 218 return ntrials
219
220 def AppendVersion(self, f, n):
221 self.Checkout(n)
222 rf = open(self.Verf(n), "r")
223 data = rf.read()
224 f.write(data)
225 rf.close()
226 return len(data)
227
219# 228#
220# This class recursively scans a directory for rcsfiles 229# This class recursively scans a directory for rcsfiles
221class RcsFinder: 230class RcsFinder:
@@ -428,6 +437,7 @@ def RunCommandIO(args,infn,outfn):
428 437
429def RunXdelta3(args): 438def RunXdelta3(args):
430 try: 439 try:
440 #print 'RUN', args
431 xdelta3.main(args) 441 xdelta3.main(args)
432 except Exception, e: 442 except Exception, e:
433 raise CommandError(args, "xdelta3.main exception") 443 raise CommandError(args, "xdelta3.main exception")
@@ -453,6 +463,7 @@ class Xdelta3Pair:
453 self.type = 'xdelta3' 463 self.type = 'xdelta3'
454 self.decode_args = '-dqf' 464 self.decode_args = '-dqf'
455 self.encode_args = '-eqf' 465 self.encode_args = '-eqf'
466 self.extra = []
456 self.presrc = '-s' 467 self.presrc = '-s'
457 self.canrep = 1 468 self.canrep = 1
458 469
@@ -465,8 +476,9 @@ class Xdelta3Pair:
465 476
466 def Run(self,trial,reps): 477 def Run(self,trial,reps):
467 RunXdelta3(['-P', 478 RunXdelta3(['-P',
468 '%d' % reps, 479 '%d' % reps] +
469 self.encode_args, 480 self.extra +
481 [self.encode_args,
470 self.presrc, 482 self.presrc,
471 self.old, 483 self.old,
472 self.new, 484 self.new,
@@ -498,7 +510,7 @@ def Test():
498 len(rcsf.skipped)) 510 len(rcsf.skipped))
499 print StatList([x.rcssize for x in rcsf.rcsfiles], "rcssize", 1).str 511 print StatList([x.rcssize for x in rcsf.rcsfiles], "rcssize", 1).str
500 print StatList([x.totrev for x in rcsf.rcsfiles], "totrev", 1).str 512 print StatList([x.totrev for x in rcsf.rcsfiles], "totrev", 1).str
501 pairs = rcsf.PairsByDate(Xdelta3Pair()) 513 return rcsf
502 514
503def Decimals(max): 515def Decimals(max):
504 l = [0] 516 l = [0]
@@ -547,6 +559,52 @@ def ReportSpeed(L,tr,desc):
547 print '%s 0-run length %u: dsize %u: time %.3f ms: encode %.0f B/sec: in %ux%u trials' % \ 559 print '%s 0-run length %u: dsize %u: time %.3f ms: encode %.0f B/sec: in %ux%u trials' % \
548 (desc, L, tr.r1.dsize, tr.time.mean * 1000.0, ((L+tr.r1.dsize) / tr.time.mean), tr.trials, tr.reps) 560 (desc, L, tr.r1.dsize, tr.time.mean * 1000.0, ((L+tr.r1.dsize) / tr.time.mean), tr.trials, tr.reps)
549 561
562def BigFileRuns(rcsf):
563 rand = random.Random()
564 f1 = open(TMPDIR + "/big.1", "w")
565 f2 = open(TMPDIR + "/big.2", "w")
566 f1sz = 0
567 f2sz = 0
568 for file in rcsf.rcsfiles:
569 if file.versions < 2:
570 continue
571 r1 = 0
572 r2 = 0
573 while r1 == r2:
574 r1 = rand.randint(0, len(file.versions) - 1)
575 r2 = rand.randint(0, len(file.versions) - 1)
576 f1sz += file.AppendVersion(f1, r1)
577 f2sz += file.AppendVersion(f2, r2)
578
579 f1.close()
580 f2.close()
581
582 print "Test input sizes: %d %d" % (f1sz, f2sz)
583
584 while 1:
585
586 extras = [
587 ['-1'],
588 ['-C', '32,32,4,2,2,1,0,0,64,0'],
589 ['-9'],
590 ['-C', '64,64,4,128,16,0,1,8,128,0'],
591 ]
592
593 for extra in extras:
594 runner = Xdelta3Pair()
595 runner.extra = extra
596 result = TimeRun(runner.Runner(TMPDIR + "/big.1", 1,
597 TMPDIR + "/big.2", 2))
598
599 print 'testing %s dsize %d: time %.7f: in %u/%u trials' % \
600 (extra,
601 result.r1.dsize,
602 result.time.mean,
603 result.trials,
604 result.reps)
605 # continue
606 # end
607
550def RunSpeed(): 608def RunSpeed():
551 for L in Decimals(MAX_RUN): 609 for L in Decimals(MAX_RUN):
552 SetFileSize(RUNFILE, L) 610 SetFileSize(RUNFILE, L)
@@ -558,9 +616,11 @@ def RunSpeed():
558if __name__ == "__main__": 616if __name__ == "__main__":
559 try: 617 try:
560 os.mkdir(TMPDIR) 618 os.mkdir(TMPDIR)
561 Test() 619 rcsf = Test()
562 RunSpeed() 620 #rcsf.PairsByDate(Xdelta3Pair())
621 #RunSpeed()
622 BigFileRuns(rcsf)
563 except CommandError: 623 except CommandError:
564 pass 624 pass
565 else: 625
566 RunCommand(['rm', '-rf', TMPDIR]) 626 RunCommand(['rm', '-rf', TMPDIR])
diff --git a/xdelta3/xdelta3.prj b/xdelta3/xdelta3.prj
index 4bb85e5..3775204 100755
--- a/xdelta3/xdelta3.prj
+++ b/xdelta3/xdelta3.prj
@@ -9,7 +9,7 @@
9(Checkin-Login jmacd) 9(Checkin-Login jmacd)
10(Populate-Ignore ()) 10(Populate-Ignore ())
11(Project-Keywords 11(Project-Keywords
12 (Xdelta3Version "0j") 12 (Xdelta3Version "0k")
13 (WWWLeftNavBar "<table cellpadding=\"20px\" width=700> <tr> <td class=\"leftbdr\" valign=top height=600 width=100> <div class=\"leftbody\"> <h1>Xdelta</h1> <a href=\"xdelta3.html\">overview</a><br> <a href=\"xdelta3-cmdline.html\">command&nbsp;line</a><br> <a href=\"xdelta3-api-guide.html\">api&nbsp;guide</a><br> <br><a href=\"http://xdelta.org\">xdelta.org</a></h2> </div> </td> <td valign=top width=500>") 13 (WWWLeftNavBar "<table cellpadding=\"20px\" width=700> <tr> <td class=\"leftbdr\" valign=top height=600 width=100> <div class=\"leftbody\"> <h1>Xdelta</h1> <a href=\"xdelta3.html\">overview</a><br> <a href=\"xdelta3-cmdline.html\">command&nbsp;line</a><br> <a href=\"xdelta3-api-guide.html\">api&nbsp;guide</a><br> <br><a href=\"http://xdelta.org\">xdelta.org</a></h2> </div> </td> <td valign=top width=500>")
14 ) 14 )
15(Files 15(Files