{"id":904,"date":"2005-11-11T12:00:00","date_gmt":"2005-11-11T12:00:00","guid":{"rendered":"http:\/\/orcldoug.com\/blog\/?p=904"},"modified":"2005-11-11T12:00:00","modified_gmt":"2005-11-11T12:00:00","slug":"speccy-instrumentation","status":"publish","type":"post","link":"http:\/\/orcldoug.com\/blog\/2005\/11\/11\/speccy-instrumentation\/","title":{"rendered":"Speccy Instrumentation"},"content":{"rendered":"<p class=\"mobile-post\">Code instrumentation is a subject that&#8217;s discussed constantly in Oracle-land, probably because Oracle&#8217;s server is instrumented pretty well. Once you&#8217;ve debugged or tuned an application with embedded instrumentation code you can never go back to just guessing &#8211; it&#8217;s too frustrating.<\/p>\n<p><\/p>\n<p class=\"mobile-post\">Every now and again it occurs to me that there are some aspects of software development that have always been important and will remain important no matter the operating system, language or application. Instrumentation is one of those aspects. At the danger of appearing to make light of the subject (which I am definitely not) I&#8217;m often amazed by the similarities between the issues and solutions in old-time 8-bit machine code programming and the much more complex software and hardware environment we work with today.<\/p>\n<p><\/p>\n<p class=\"mobile-post\">One of the key challenges in ZX Spectrum game programming was the avoidance of graphics flickering on the screen during play. These days I assume it&#8217;s much easier with the prevalence of dedicated graphics chips and the like, but the only way to display game graphics on a Spectrum was to take some numbers containing the bitmap images and copy them (quickly) into the memory locations that were mapped to the screen. The trick was to avoid being part of the way through copying the graphic as the raster (the thing in the TV that displays the image) passed through that location on the screen. If the two interfered &#8211; &#8216;flicker, flicker&#8217;, as my mate Joffa used to say.<\/p>\n<p><\/p>\n<p class=\"mobile-post\">There were lots of different approaches to this problem, but what tended to be consistent was the attempt to do as much work as possible in the time between the raster hitting the bottom of the screen (when an interrupt would be generated) and the raster reaching the top of the displayable area (excluding the border). So what we did was write an interrupt service routine to display all of the graphics and that would be automatically invoked when the screen had been refreshed. The screen draw routine would work frantically to try to have everything redrawn in (and I hope I remember this correctly) the next 14200 T-states or processor cycles during which the raster flew back to the top of the screen and drew the top border area.<\/p>\n<p><\/p>\n<p class=\"mobile-post\">So what&#8217;s this got to do with instrumentation? Well, how were we to know where the raster was on the screen when a particular bit of code was executing &#8211; which was crucial? We simply changed the border to different colours (which was a very light-weight instruction) so that we could see on the screen just how far the raster had travelled down it at a particular point in our code. If the colours started to indicate that we were straying into the displayable area, there was a chance of flicker. Simple but extremely effective! It was also a great way of seeing the &#8216;profile&#8217; of your code &#8211; which bits were taking too long<\/p>\n<p><\/p>\n<p class=\"mobile-post\">On a side-note, this is also the reason why you&#8217;ll quite often see Spectrum games try to put as much static high score information and the like at the top of the screen, to give the programmer more time to display the playable area &#128521;<\/p>\n<p><\/p>\n<p class=\"mobile-post\">P.S. I&#8217;m posting this via email &#8211; hope it works kay.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Code instrumentation is a subject that&#8217;s discussed constantly in Oracle-land, probably because Oracle&#8217;s server is instrumented pretty well. Once you&#8217;ve debugged or tuned an application with embedded instrumentation code you can never go back to just guessing &#8211; it&#8217;s too frustrating. Every now and again it occurs to me that there are some aspects of&hellip; <a class=\"more-link\" href=\"http:\/\/orcldoug.com\/blog\/2005\/11\/11\/speccy-instrumentation\/\">Continue reading <span class=\"screen-reader-text\">Speccy Instrumentation<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-904","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":845,"url":"http:\/\/orcldoug.com\/blog\/2006\/03\/06\/hotsos-day-1-0\/","url_meta":{"origin":904,"position":0},"title":"Hotsos &#8211; Day 1.0","date":"March 6, 2006","format":false,"excerpt":"Well, that's the morning over with and I'm enjoying myself. First up was breakfast - cereal, pastries, fruit, juice, coffee. It's a nice touch, gets everyone networking early and almost justifies the 8:30 start \ud83d\ude09Then at 8:30, after a brief introduction of music and photos of past events, Gary Goodman\u2026","rel":"","context":"With 2 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1538,"url":"http:\/\/orcldoug.com\/blog\/2009\/11\/03\/my-first-web-conference\/","url_meta":{"origin":904,"position":1},"title":"My First Web-Conference","date":"November 3, 2009","format":false,"excerpt":"Last week (yeah, I've been busy) was the first time I'd delivered a web-conference - using Microsoft LiveMeeting at my current customer site. As others have reported in the past, it's a little weird not being able to look into the eyes of the people you're presenting to but I'm\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1658,"url":"http:\/\/orcldoug.com\/blog\/2011\/11\/07\/upcoming-ukoug-conference\/","url_meta":{"origin":904,"position":2},"title":"Upcoming UKOUG Conference","date":"November 7, 2011","format":false,"excerpt":"I always look forward to this time of year as the annual UKOUG conference in Birmingham approaches but this year I think I'm looking forward to it more than ever.As I'll have delivered both of my own presentations at previous events my slides will be done before I arrive and\u2026","rel":"","context":"With 8 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1720,"url":"http:\/\/orcldoug.com\/blog\/2014\/08\/05\/get-up-offa-that-thing\/","url_meta":{"origin":904,"position":3},"title":"Get Up Offa That Thing","date":"August 5, 2014","format":false,"excerpt":"No, no, no ... not *that* JB! As regular readers will know, the JB who tends to get mentioned most often around these parts is John Beresniewicz who, up until recently, worked at Oracle on all the cool OEM Performance Pages and related instrumentation (alongside others, of course, such as\u2026","rel":"","context":"With 1 comment","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1371,"url":"http:\/\/orcldoug.com\/blog\/2007\/12\/24\/the-reality-gap-4-its-never-the-san\/","url_meta":{"origin":904,"position":4},"title":"The Reality Gap (4) &#8211; It&#8217;s never the SAN","date":"December 24, 2007","format":false,"excerpt":"I've left one of my favourite topics for the penultimate episode of this mini-series. The more sites you work at and the more performance problems you work on, the more you begin to learn the one essential truth of modern system architecture. It's never the SAN. Here's a true story.\u2026","rel":"","context":"With 11 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":851,"url":"http:\/\/orcldoug.com\/blog\/2006\/02\/28\/my-hotsos-agenda\/","url_meta":{"origin":904,"position":5},"title":"My Hotsos Agenda","date":"February 28, 2006","format":false,"excerpt":"I'm a bit surprised how excited I am about going to Dallas for the Hotsos Symposium next week (have I mentioned it yet?). I've already worked my personal agenda out but it hasn't been easy with two streams of equally high quality presentations. The full schedule is here and here's\u2026","rel":"","context":"With 11 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/comments?post=904"}],"version-history":[{"count":0,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/904\/revisions"}],"wp:attachment":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/media?parent=904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/categories?post=904"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/tags?post=904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}