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.19 date: 2021/01/20 10:32:13
user: cg
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)

copyright

COPYRIGHT (c) 2010 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:16:50 GMT