tpf_ecbmc_query_rct: Query resource limit counts in the ECB

This function queries the resource counts in the resource counter table (RCT) for the current entry control block (ECB).

Last updated

  • Changed for PUT12.
  • Added for PUT10.

Format

#include <tpf/sysapi.h>
#include <tpf/i_idcrct.h>

int tpf_ecbmc_query_rct(struct tpf_ecbmc *rct)
rct
A pointer to the complete array of counts as defined by the tpf_ecbmc structure.

Normal return

A value of 0.

Error return

A non-zero value indicates that the address provided for the tpf_ecbmc structure is not valid.

Programming considerations

  • For the file rate, the value returned in the rf_count field is the count of the number of files that were processed by this ECB at the end of the last time interval. The value in the file_count field is the count of total files that were processed by this ECB. To determine the number of files that were processed in the current interval, subtract the value that is returned in the rf_count field from the value that is returned in the file_count field.
  • For the WTOPC rate, the value returned in the wtopr_count field is the count of the number of WTOPC macros that were processed by this ECB at the end of the last time interval. The value in the wtop_count field is the count of total WTOPC macros that were processed by this ECB. To determine the number of WTOPC macros that were processed in the current interval, subtract the value that is returned in the wtopr_count field from the value that is returned in the wtop_count field.
  • For the SERRC rate, the value that is returned in the sera_count field is the count of SERRC macros that this ECB processed at the end of the last interval. The value in the serr_count field is the count of SERRC macros that this ECB processed. To determine the number of SERRC macros that this ECB processed in the current interval, subtract the value that is returned in the sera_count field from the value that is returned in the serr_count field.
  • For the SNAPC rate, the value returned in the snra_count field is the count of SNAPC macros that this ECB processed at the end of the last time interval. The value in the snap_count field is the count of SNAPC macros that this ECB processed. To determine the number of SNAPC macros that this ECB processed in the current interval, subtract the value that is returned in the snra_count field from the value that is returned in the snap_count field.

Examples

The following example obtains the current file count and compares that count with the current file limit. If the difference is within 100, the file limit is increased by 100 and set to the new value. Finally, the areas obtained by the queries are freed.
struct tpf_ecbmc  ecbmcRct;
struct tpf_ecbmc *ecbmcRlt;

tpf_ecbmc_rct(&ecbmcRct);
ecbmcRlt = (struct tpf_ecbmc *)tpf_ecbmc_query();

if (ecbmcRct.file_count + 100 >= ecbmcRlt->file_limit)
{
    ecbmcRlt->file_limit += 100;
    rc = tpf_ecbmc_set(ecbmcRlt);
}
  free(ecbmcRlt);