Finds all ids of activities that are triggered by the given id. This function works recursive, i.e. any activity triggered by a child of the root activity is included as well.
For this to work, activities are assumed to be in the order that they were triggered. This can easily be achieved by simply sorting the activities by their init timestamp.
(number)
the id of the root activity we whose triggered
children
we are trying to find
(function)
a predicate that will finish the activity walk if it returns
true
.
Function signature:
(id, activity)
.
Set<number>
:
the provided root id and all ids of activities triggered by it or any of it's children,
grandchildren, etc.
Finds the oldest activity of the ones supplied via the ids. We consider an activity older than another one if it's init timestamp is further in the past.
Any ids we can't find as in the activities are ignored.
Number
:
the id of the oldest activity or
null
if no activity for any id was found
Finds the activity of the ones supplied via the ids that initialized immediately before the one with the given id initialized.
(Number)
id of the activity for which we will find the activity that initialized immediately before
Number
:
the id that initialized immediately before the activity with
id
or
null
if no activity for any
id was found
Prettifies the provided timestamp which is expected to be in nanoseconds.
(number)
timestamp in nanoseconds
Object<string, number>
:
an object with an
ms
property which is the prettified version
of the provided timestamp in milliseconds and
ns
, the originally passed timestamp.
Safely extracts the val
property from the object x
.
any
:
the
val
property if
x
was defined, otherwise
null
Safely gets the first time stamp of the given timestamps.
If no timestamp is found, a time of 0
is returned.
Object
:
the prettified first time stamp
Finds the first stamp in the array of time stamp arrays that has a valid time stamp. If none is found it will return a zero time stamp.
Object
:
prettified time stamp or
prettyNs(0)
if not found
Identifies all user functions within the given functions, adds location and propertyPath strings and returns the result.
The propertyPath
is deduced from the path
array.
If a user function is found twice it will only be included once.
Array<Object>
:
all user functions with the above mentioned details added
Pulls user functions from all resources of the provided info and attaches
them as the userFunctions
property to the info object directly.
As a result, instead of having a userFunctions
array on each resource
we end up with just one on the info object.
(Object)
the info object which references the resources
Merges the userFunctions
found on the info
object, such that all functions
with the same location
property are represented as one.
As the result the propertyPath
array is removed from all functions and replaced
with the propertyPaths
array which combines the propertyPath
s of all functions
that matched the location
.
Obtains the life cycle information using the init
and destroy
time stamps
of the given activity.
All time stamps have the format: { ns: <time in naseconds>, ms: <pretty printed time> }
The return value includes the following properties:
created: when the resource was created, i.e. it's init time stamp
destroyed: when the resource ceased to exist, i.e. it's destroy time stamp
timeAlive: the difference between the above two
If the destroy
time stamp isn't avaible it is set to a prettified version of 0
.
The same is true in that case for the timeAlive
.
(Object)
the activity whose life cycle to assess
Object
:
the life cycle information
Applies multiple processors to the given activities in order to process them into operations. Each activity that is identified as part of an operation is removed from the activities map, i.e. it is modified in place. Therefore any activities still present in the map after processing completes, couldn't be processed into an operation.
Each processor needs to be instantiable and have a process
function that returns
{ groups, operations}
.
Additionally each processor needs to have the following static properties:
(Object)
options
Name | Description |
---|---|
$0.activities Map<(Number | String), Object>
|
activities to be processed |
$0.processors Array<Object>
|
collection of processors to be applied |
$0.includeActivities Boolean
|
if
true
the activities that were used to identify
a step of an operation are attached to the data about that step
|
Array<Object>
:
a collection of operations that were identified from the
given activities