memtrack_module Struct Reference

memtrack_module Struct Reference

#include < memtrack.h >

Data Fields

struct hw_module_t   common
 
int(*  init )(const struct memtrack_module *module)
 
int(*  getMemory )(const struct memtrack_module *module, pid_t pid, int type, struct memtrack_record *records, size_t *num_records)
 

Detailed Description

Every hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with hw_module_t followed by module specific information.

Definition at line 120 of file memtrack.h .

Field Documentation

struct hw_module_t common

Definition at line 121 of file memtrack.h .

int(* getMemory)(const struct memtrack_module *module, pid_t pid, int type, struct memtrack_record *records, size_t *num_records)

(*getMemory)() expects an array of record objects and populates up to *num_record structures with the sizes of memory plus associated flags for that memory. It also updates *num_records with the total number of records it could return if *num_records was large enough when passed in. Returning records with size 0 is expected, the number of records should not vary between calls to getMemory for the same memory type, even for different pids.

The caller will often call getMemory for a type and pid with *num_records == 0 to determine how many records to allocate room for, this case should be a fast-path in the HAL, returning a constant and not querying any kernel files. If *num_records passed in is 0, then records may be NULL.

This function must be thread-safe, it may get called from multiple threads at the same time.

Returns 0 on success, -ENODEV if the type is not supported, -errno on other errors.

Definition at line 151 of file memtrack.h .

int(* init)(const struct memtrack_module *module)

(*init)() performs memtrack management setup actions and is called once before any calls to getMemory() . Returns 0 on success, -errno on error.

Definition at line 128 of file memtrack.h .


The documentation for this struct was generated from the following file: