comp hypersim_patterns
API Reference Manual  /  Python API  / 

update_checkpoint

Name

update_checkpoint

Synopsis

Python

import update_checkpoint

Description

The update_checkpoint module contains Simics API functions for writing checkpoint updaters.

See the Model Builder User's Guide for more details, in the Checkpoint Compatibility chapter.

update_checkpoint.SIM_register_class_update

Synopsis

update_checkpoint.SIM_register_class_update(build_id, classname, function)

Description

Registers a class update function.

Register the class update function function for class classname, to be run when updating a checkpoint to build-id build_id.

The function acts on a single object of a given class. It will be called for all matching objects with the current object as argument. It doesn’t need to return anything, however it can’t create or destroy objects, only change the attributes of the object it got as parameter, except the object name.

update_checkpoint.SIM_register_generic_update

Synopsis

update_checkpoint.SIM_register_generic_update(build_id, function)

Description

Registers a generic update function.

Register the generic update function function to be run when updating a checkpoint to build-id build_id. The function acts on one or several objects of various classes, and may rename, create or destroy objects. When the checkpoint reaches the required build-id, the function will be called once with the complete set of objects that constitute the checkpoint as a parameter. It is expected to return three lists of pre_conf_objects: (deleted objects, changed objects, added objects). Deleted objects must have been removed from the configuration, changed objects can have any attribute changed (including their class or their name). Added objects must have been added to the configuration.

When renaming an object, the function is expected to remove the object from the checkpoint set under its old name and to add it again under its new name. The object should be reported in the changed object list.

update_checkpoint.SIM_register_post_update

Synopsis

update_checkpoint.SIM_register_post_update(function)

Description

Registers a generic update function.

Register the generic update function function to be run when updating a checkpoint to build-id build_id. after all build-id based update functions have run, but before the checkpoint is loaded. The function should behave as functions added with update_checkpoint.SIM_register_generic_update.

update_checkpoint.all_objects

Synopsis

update_checkpoint.all_objects(set, classname)

Description

Returns all objects of a given class.

This function should only be used while updating checkpoints, as

described in Model Builder User's Guide, in the Checkpoint Compatibility chapter.

Return a list of all objects of class classname present in the checkpoint set.

update_checkpoint.for_all_objects

Synopsis

update_checkpoint.for_all_objects(set, classname, function)

Description

Apply a function on all objects of a given class.

This function should only be used while updating checkpoints, as

described in Model Builder User's Guide, in the Checkpoint Compatibility chapter.

Apply the function function on all objects of class classname present in set. function is defined as:

function(config, object)

where config is the Python dictionary containing all objects, and object is an object of class classname.

update_checkpoint.get_checkpoint_filename

Synopsis

update_checkpoint.get_checkpoint_filename()

Description

The file name of the checkpoint being updated.

update_checkpoint.remove_attr

Synopsis

update_checkpoint.remove_attr(obj, name)

Description

Removes an attribute.

This function should only be used while updating checkpoints, as described in Model Builder User's Guide, in the Checkpoint Compatibility chapter.

Remove the attribute name from the object obj.

update_checkpoint.remove_class

Synopsis

update_checkpoint.remove_class(set, classname)

Description

Removes all instances of a class.

This function should only be used while updating checkpoints, as described in Model Builder User's Guide, in the Checkpoint Compatibility chapter.

In the checkpoint set, remove all objects of class classname.

update_checkpoint.remove_class_attr

Synopsis

update_checkpoint.remove_class_attr(set, classname, name)

Description

Removes a class attribute.

This function should only be used while updating checkpoints, as described in Model Builder User's Guide, in the Checkpoint Compatibility chapter.

In the checkpoint set, remove the class attribute name from all objects of class classname.

update_checkpoint.rename_attr

Synopsis

update_checkpoint.rename_attr(obj, new_attr, old_attr)

Description

Renames an attribute.

This function should only be used while updating checkpoints, as described in Model Builder User's Guide, in the Checkpoint Compatibility chapter.

Rename the attribute old_attr to new_attr in the object obj.

comp hypersim_patterns