Hi All,<div><br></div><div>    I&#39;ve just needed to make sense of a very long log file generated by strace.  The log file is full of entries like:</div><div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">--- SIGALRM (Alarm clock) @ 0 (0) ---</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">gettimeofday({1265744804, 491238}, NULL) = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">sigreturn()                             = ? (mask now [])</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><br></div><div>and my workspace script reduces these to e.g.</div><div><br></div></div>
<div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">--- SIGALRM (Alarm clock) @ 0 (0) ---</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">gettimeofday({1265744797, 316183}, NULL) = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">sigreturn()                             = ? (mask now [])</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">NEXT 2 LINES REPEAT 715 TIMES</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">--- SIGALRM (Alarm clock) @ 0 (0) ---</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">gettimeofday({1265744797, 317189}, NULL) = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">sigreturn()                             = ? (mask now [])</font></div>
<div><br></div></div><div><br></div><div>My question is has anyone looked at this issue in any depth and perhaps come up with something not as crude as the below and possibly even recursive.  i.e. the above would ideally be reduced to e.g.</div>
<div><br></div><div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">NEXT 7 LINES REPEAT 123456 TIMES</span></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">--- SIGALRM (Alarm clock) @ 0 (0) ---</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">gettimeofday({1265744797, 316183}, NULL) = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">sigreturn()                             = ? (mask now [])</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">NEXT 2 LINES REPEAT BETWEEN 500 AND 800 TIMES</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0x80045530, 0xbfd4fe70)        = 0</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">ioctl(8, 0xc1205531, 0xbfd4fb80)        = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">--- SIGALRM (Alarm clock) @ 0 (0) ---</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">gettimeofday({1265744797, 317189}, NULL) = 0</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">sigreturn()                             = ? (mask now [])</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br>
</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div></div><div><div>Here&#39;s my quick hack that I ran in vw7.7nc:</div>
<div><br></div><div>| f o lines maxrun repeats range |</div><div>f := &#39;../Cog/squeak.strace.log&#39; asFilename readStream.</div><div>o := &#39;compressed.log&#39; asFilename writeStream.</div><div>lines := OrderedCollection new.</div>
<div>maxrun := 50.</div><div>repeats := 0.</div><div>range := nil.</div><div>[[f atEnd] whileFalse:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>[lines size &gt; maxrun ifTrue:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[repeats &gt; 0</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>ifTrue:</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>[1 to: range first - 1 do:</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>[:i| o nextPutAll: (lines at: i); cr].</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>o nextPutAll: &#39;NEXT &#39;; print: range size; nextPutAll: &#39; LINES REPEAT &#39;; print: repeats + 1; nextPutAll: &#39; TIMES&#39;; cr.</div><div>
<span class="Apple-tab-span" style="white-space:pre">                                </span>range do:</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>[:i| o nextPutAll: (lines at: i); cr].</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>lines removeFirst: range last.</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>repeats := 0]</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>ifFalse:</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>[o nextPutAll: lines removeFirst; cr; flush].</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> range := nil].</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>lines addLast: (f upTo: Character cr).</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>[:exit|</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>1 to: lines size do:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[:i| | line repeat |</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>line := lines at: i.</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>repeat := lines nextIndexOf: line from: i + 1 to: lines size.</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(repeat ~~ nil</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> and: [lines size &gt;= (repeat - i * 2 + i)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> and: [(i to: repeat - 1) allSatisfy: [:j| (lines at: j) = (lines at: j - i + repeat)]]]) ifTrue:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>[repeats := repeats + 1.</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> range isNil</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>ifTrue: [range := i to: repeat - 1]</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>ifFalse:</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>[range = (i to: repeat - 1) ifTrue:</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>[range do: [:ignore| lines removeAtIndex: repeat].</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                </span> exit value]]]]] valueWithExit]]</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ensure: [f close. o close].</div><div>repeats</div>
<div><br></div><div>Forgive the cross post.  I expect deep expertise in each newsgroup posted to.</div><div><br></div><div>best</div><div>Eliot</div></div>