Resources Representing the Sum of Others

The procedure vtk_resourcemap_sum is used to define a resource map as the sum of other resource maps. It takes two arguments:
  • The name of the resource map
  • The list of the resource components
For example, suppose you have a resource map called License:a and another called License:b. You can create a sum resource called License:sum using:
# This code fragment typically goes into resources.tcl
vtk_resourcemap_sum License:sum [list License:a License:b]
This results in a resource License:sum defined as follows:
# This is the result of using vtk_resourcemap_sum....
vtk_resourcemap_set License:sum -max [expr $qa+$qb] -map "License:a OR License:b"

## ... or this map if you activate "commas" (see Commas vs. ORs in Resources).
vtk_resourcemap_set License:sum -max [expr $qa+$qb] -map "License:a,License:b"

Where qa and qb are the current max values for License:a and License:b respectively. The sums are recomputed by vovresourced about once a minute, or by Allocator every 30 seconds.