Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Automatic Creation and Removal of Smalltalk Hooks

IP.com Disclosure Number: IPCOM000109899D
Original Publication Date: 1992-Sep-01
Included in the Prior Art Database: 2005-Mar-24
Document File: 4 page(s) / 128K

Publishing Venue

IBM

Related People

Eisen, I: AUTHOR [+3]

Abstract

This article describes a way to create and to remove programming hooks from Smalltalk code. The process of manually adding programming hooks to Smalltalk code is error-prone and time-consuming. A hook is a method that can be used to write execution-time data. The output data from the hook can then be analyzed at a later time. Hooks are often used to get performance data, RAS (reliability, availability, and service) data, or execution-tracing data. It is especially troublesome when the hooks are used for a special purpose and are not to be included in the shipped software. During the development process, the code changes from driver to driver. This means the work to add a hook has to be repeated whenever a new driver becomes available.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 46% of the total text.

Automatic Creation and Removal of Smalltalk Hooks

       This article describes a way to create and to remove
programming hooks from Smalltalk code.  The process of manually
adding programming hooks to Smalltalk code is error-prone and
time-consuming.  A hook is a method that can be used to write
execution-time data.  The output data from the hook can then be
analyzed at a later time.  Hooks are often used to get performance
data, RAS (reliability, availability, and service) data, or
execution-tracing data.  It is especially troublesome when the hooks
are used for a special purpose and are not to be included in the
shipped software.  During the development process, the code changes
from driver to driver.  This means the work to add a hook has to be
repeated whenever a new driver becomes available.

      An automated way to add hooks to Smalltalk software under
development is needed.  This invention proposes an easy, repeatable,
and automated technique for adding hooks to a programmer's copy of a
Smalltalk software product.

      The programmer creates a file, called the "hook designation
file", that contains a list of the classes and methods that need to
be hooked.  A global Smalltalk object, named "PerformanceTester",
reads the hook designation file and hooks the methods listed in the
file.

      Each method is hooked in the following manner:
-    The method is renamed.
-    A new method with the original name and formal arguments is
created.
-    Code to hook the renamed method is added to the new method.

      PerformanceTester global Smalltalk object: This global
Smalltalk object provides the services to hook and unhook methods.
You can send it the following messages:
hookPerFile: aPathName                     Hook all methods that are
identified in the "aPathName (i.e., hook designation) file.
unhookPerFile: aPathName                   Unhook all methods that
are identified in the "aPathName" (i.e., hook designation) file.
hookSelector: aSymbol inClass: aBehavior   Hook method "aSymbol" in
class "aBehavior".
unhookSelector: aSymbol inClass: aBehavior Unhook method "aSymbol" in
class "aBehavior".
unhookAll                                  Unhook all methods.
hookClass: aBehavior                       Hook all methods in class
"aBehavior".
unhookClass: aBehavior                     Unhook all methods in
class "aBehavior".

      Hook Designation File: This file tells the global
PerformanceTester object what methods are to be hooked or unhooked.
Note that empty lines can be interspersed throughout the file.  Each
file line contains zero or one record.
  <HookDesignationFile> ::= {<Line>}
     <Line>              ::= &lbrk.LineText&rbrk. <EOL>
       <LineText>        ::= <HookRec>   <comment>

      A hook record identifies a class and, option...