eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'InstrumentationContext':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: InstrumentationContext


Inheritance:

   Object
   |
   +--InstrumentationContext

Package:
stx:libcomp
Category:
System-Compiler-Instrumentation
Version:
rev: 1.18 date: 2017/07/12 14:13:05
user: mawalch
file: InstrumentationContext.st directory: libcomp
module: stx stc-classLibrary: libcomp

Description:


installed as a thread-local variable (instrumentationContext) by the
beActiveIn:aProcess method, instances of me keep some meta state while
instrumentation is ongoing.

Especially, instrumentationInfo objects are only updated in processes with a context. 
This has two advantages:
    - it blocks recursive calls, while inside instrumentation code
    - it blocks measurements from other processes 
      (so code coverage is only measured when executed during a test run, not if
       executed by other processes)

the main entries are run: and runForCoverage:
the code must have been recompiled with instrumentation before
(see InstrumentingCompiler - class protocol)


Class protocol:

instance access
o  current
the current context for this running thread.
walks along the parent-process chain, up to a possible global context

usage example(s):

     InstrumentationContext current

o  forProcess: aProcess
the context for this thread.
walks along the parent-process chain, up to a possible global context

instance creation
o  new
return an initialized instance

queries
o  hasGlobalInstrumentationContext
InstrumentationContext hasGlobalInstrumentationContext

running
o  run: aBlock
run aBlock with instrumentation enabled

usage example(s):

     Smalltalk loadPackage:'stx/goodies:regression'.
     BTree withAllPrivateClasses
        do:[:cls | cls recompileUsingCompilerClass:InstrumentingCompiler].
     InstrumentationContext
        run:[ RegressionTests::BinaryTreeTester suite run ].
     (Tools::NewSystemBrowser open)
        switchToClass:BTree;
        showCoverageInformation value:true

o  runForCoverage: aBlock
run aBlock with instrumentation enabled, but only for coverage (i.e. not counting)

utilities
o  flushAllPerProcessInstrumentationContexts
self flushAllPerProcessInstrumentationContexts

o  globalInstrumentationContext

o  setGlobalInstrumentationContext: aContextOrNil
setup for global instrumentation: instrumentation is performed for all processes

o  setInstrumentationContext: aContextOrNil in: aProcess
setup for process specific instrumentation:
instrumentation is aProcess


Instance protocol:

accessing
o  coverageOnly
if on, only keep track of coverage (not counting);
if off, we also count how often the code has been entered,
and by which sender

o  coverageOnly: aBoolean
if on, only keep track of coverage (not counting);
if off, we also count how often the code has been entered

o  enabled

o  enabled: aBoolean
Modified (format): / 08-08-2011 / 14:47:12 / cg

o  inInstrumentedCode

o  inInstrumentedCode: aBoolean
Modified (format): / 08-08-2011 / 19:43:19 / cg

initialization
o  initialize
Invoked when a new instance is created.

usage example(s):

super initialize.   -- commented since inherited method does nothing

installing
o  beActiveEverywhere
become the current instrumentaion context for all processes.

usage example(s):

     InstrumentationContext new beActiveEverywhere

o  beActiveIn: aProcess
become the current instrumentaion context for a process.

usage example(s):

     InstrumentationContext new beActiveIn:(Processor activeProcess)

queries
o  enabledAndNotInInstrumentedCode

running
o  run: aBlock
run aBlock with instrumentation enabled

o  runForCoverage: aBlock
run aBlock with instrumentation enabled;
but only for coverage (i.e. not counting)



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 18 Apr 2024 01:28:11 GMT