Callback Function to Automatically Create Snapshots for Backup
The following code illustrates a custom callback function that automatically creates a snapshot for backup purposes. You can add such a function in your .cdsinit file to automatically create a snapshot of the session.
;; Callback function to save create snapshots automatically for each simulation run.
;; Callback function to auto save all active Verifier cellviews. ;; Specify the save interval in seconds as argument, like: ;; AutoCreateSnapshotForCellView("test" "run" "verifier") ;; AutoCreateSnapshotForCellView("test" "run" "verifier") ;; AutoCreateSnapshotForSession(sessionId 120) ;; AutoCreateSnapshotForSession(sessionId) ;; AutoCreateSnapshot(120 hiGetCurrentWindow()) ;; AutoCreateSnapshot(120) ;; AutoCreateSnapshot() ;; This will auto create the snapshot for that cellview every 5 minutes. ;; To interrupt the auto creation, set the global variable ;; StopCreateSnapshot = t ;;
procedure(AutoCreateSnapshotForCellView(lib cell view @optional (interval 300) "tttx") let((sess) when(verifIsValidSession(sess = verifGetCellViewSession(lib cell view)) printf("Starting to create snapshot automatically...\n") when(verifCreateSnapshot(sess) printf("Created new snapshot '%s' for Verifier cellview '%s'.\n" cadr(reverse(verifGetSnapshots(sess))) buildString(verifGetSessionCellView(sess) "/")) ) if(!(boundp('StopAutoCreateSnapshot) && StopAutoCreateSnapshot) then hiRegTimer(sprintf(nil "AutoCreateSnapshotForCellView(\"%s\" \"%s\" \"%s\" %d)" lib cell view interval) interval*10) printf("Next auto creation scheduled in %d seconds.\n" interval) else printf("Auto creation interrupted. Call unbindVar(StopAutoCreateSnapshot) and start AutoCreateSnapshotForCellView(<lib> <cell> <view> 300) again.\n") ) ) ) )
|
procedure(AutoCreateSnapshotForSession(sess @optional (interval 300) "gx") when(verifIsValidSession(sess) printf("Starting to create snapshot automatically...\n") when(verifCreateSnapshot(sess) printf("Created new snapshot '%s' for Verifier cellview '%s'.\n" cadr(reverse(verifGetSnapshots(sess))) buildString(verifGetSessionCellView(sess) "/")) ) if(!(boundp('StopAutoCreateSnapshot) && StopAutoCreateSnapshot) then hiRegTimer(sprintf(nil "AutoCreateSnapshot(%d)" interval) interval*10) printf("Next auto creation scheduled in %d seconds.\n" interval) else printf("Auto creation interrupted. Call unbindVar(StopAutoCreateSnapshot) and start AutoCreateSnapshotForSession(<sess> 300) again.\n") ) ) )
procedure(AutoCreateSnapshot(@optional (interval 300) (win hiGetCurrentWindow()) "xg")
let((sess) when(verifIsValidSession(sess = win->verifSession) printf("Starting to create snapshot automatically...\n") when(verifCreateSnapshot(sess) printf("Created new snapshot '%s' for Verifier cellview '%s'.\n" cadr(reverse(verifGetSnapshots(sess))) buildString(verifGetSessionCellView(sess) "/")) ) if(!(boundp('StopAutoCreateSnapshot) && StopAutoCreateSnapshot) then hiRegTimer(sprintf(nil "AutoCreateSnapshot(%d)" interval) interval*10) printf("Next auto creation scheduled in %d seconds.\n" interval) else printf("Auto creation interrupted. Call unbindVar(StopAutoCreateSnapshot) and start AutoCreateSnapshot(300) again.\n") ) ) ) )
|
Related Topics
Verifier Session and Setup Functions
Simulation and Results Extraction Functions
Snapshot Functions
Function to Get Typical Results
The following code illustrates a custom function that automatically retrieves the typical results from the specified cellview.
procedure(ReadResNum(res map name)
let((resVal out)
resVal = ReadRes(res map name)
when(resVal
sscanf(resVal "%f" out)
)
out
)
)
procedure(ReadRes(res map name)
res[car(mapcar(lambda((x) buildString(x "/" )) map))][name]
)
let((reqIDs res map min max typ typParam props sess)
;;sess = verifOpenCellView("amsPLL" "TOP_verification" "verification" ?openWindow t)
sess = 0
reqIDs = verifGetReqs(sess)
foreach(reqID reqIDs
props = verifGetReqProps(sess reqID)
printf("\n%s" props["HierId"])
res = verifGetResultDataForReq(sess reqID)
map = verifGetReqMapping(sess reqID)
printf(" -- \t%L \t"
reqID
verifGetReqProp(sess reqID "Title")
;;verifGetReqProp(sess reqID "MinSpec")
;;verifGetReqProp(sess reqID "MaxSpec")
)
when((map && length(map)==1)
;; explude mulit mapping
;;min = ReadResNum(res map "min")
;;max = ReadResNum(res map "max")
typ = ReadRes(res map "typical")
if(typ && stringp(typ) && strcmp(typ "various")==0 then
printf("typical: various ")
else
typ = ReadResNum(res map "typical")
typParam = ReadRes(res map "typicalParams") when(typ printf("typical: %L @ %L " typ typParam ) ) ) ) ) printf("\n" t)
)
|
Related Topics
Requirement Functions
Verifier Session and Setup Functions
Simulation and Results Extraction Functions
Snapshot Functions
Return to top