Initializes a playback session on Historical Server.
SMC_RETURN_CODE smc_create_playback_session (SMC_CONNECT_ID clientId, SMC_SESSION_IDP sessionIdArray, SMC_SIZET numInputSessions, SMC_CHARP startTime, SMC_CHARP endTime, SMC_HS_PLAYBACK_OPT playbackType, SMC_SIZET summarizationInterval, SMC_HS_ESTIM_OPT estimationOption, SMC_HS_MISSDATA_OPT missingDataOption, SMC_HS_TARGET_OPT playbackTarget, SMC_CHARP directoryName SMC_HS_SESS_PROT_LEVEL protectionLevel, SMC_HS_SESS_SCRIPT_OPT scriptOption, SMC_HS_SESS_DELETE_OPT deleteOption, SMC_SESSION_IDP sessionIdHandle)
identifies the connection.
array of session numbers identifying the existing recording session(s) on Historical Server that furnishes data for this playback session. If more than one input session is specified, then they all must have been defined to record data from the same Adaptive Server, and they must be ordered chronologically.
If playbackTarget is SMC_HS_TARGET_FILE, then there must not be any gaps between the times covered by multiple input sessions. The input sessions must contain data for all times between the startTime and endTime parameters.
the number of input sessions, that is, the length of the sessionIdArray. Must be at least one.
null-terminated string containing the time to start playback, using the format:
yyyy/mm/dd hh:mm[:ss] [time zone]
The default is to start at the beginning of the first input session.
null-terminated string containing the time at which to stop playback, using the format:
yy/mm/dd hh:mm[:ss] [time zone]
The default is to stop at the end of the last input session.
specifies the level of detail of the playback. Valid values are:
SMC_HS_PBTYPE_RAW – plays back data as it was collected, using whatever (possibly varying) intervals are contained in the input session. This option can include snapshot data such as current SQL statement data and status on locks or processes. Valid only with playbackTarget SMC_HS_TARGET CLIENT.
SMC_HS_PBTYPE_ACTUAL – plays back data at whatever (possibly varying) intervals are contained in the input session(s). This option cannot include snapshot data.
SMC_HS_PBTYPE_INTERVAL – plays back data summarized into sample intervals of the length specified in summarizationInterval.
SMC_HS_PBTYPE_ENTIRE – plays back data for each input recording session summarized as a single sample. The sample interval is the time between the requested playback startTime and endTime.
If playbackTarget is SMC_HS_TARGET_FILE, then playbackType must be SMC_HS_PBTYPE_INTERVAL or SMC_HS_PBTYPE_ENTIRE.
if playbackType is SMC_HS_PBTYPE_INTERVAL, then this specifies the length in seconds of the playback intervals over which the input data is to be summarized.
For other values of playbackType, applications must specify SMC_UNUSED for this parameter.
specifies whether playback may estimate the values of data items that cannot be calculated exactly. Valid values are:
SMC_HS_ESTIM_ALLOW
SMC_HS_ESTIM_DISALLOW
If SMC_HS_ESTIM_DISALLOW is specified, then a subsequent call for this playback session to smc_create_view will return an error if it includes data items requiring estimation.This option is ignored if playbackType is SMC_HS_PBTYPE_RAW.
specifies whether the Monitor Client Library will return playback samples for periods of time when no data is available in the input session(s). Valid values are:
SMC_HS_MISSDATA_SHOW – Monitor Client Library will return a sample for periods of time lacking data.
SMC_HS_MISSDATA_SKIP – Monitor Client Library will not return a sample for periods of time lacking data; instead, the Library will return data for the next available time interval for which data is available.
If playbackTarget is SMC_HS_TARGET_FILE, this parameter is ignored.
specifies whether the playback session returns data to the application or whether playback creates a new session on Historical Server. Valid values are:
SMC_HS_TARGET_CLIENT – the playback session returns data to the application, by means of calls to smc_refresh_ex.
SMC_HS_TARGET_FILE – playback creates a new session on Historical Server.
if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies the directory in which the Historical Server creates the data file(s) and error file for the new sessions to be created.
if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies the protection level of the new session to be created. Valid values are:
SMC_HS_SESS_PROT_PUBLIC
SMC_HS_SESS_PROT_PRIVATE
This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.
if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies whether Historical Server must create a script that creates tables for loading results (from the new session) into Adaptive Server. The choices are:
SMC_HS_SESS_SCRIPT_NONE – no script.
SMC_HS_SESS_SCRIPT_SYBASE – Sybase script.
This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.
if playbackTarget is SMC_HS_TARGET_FILE, this parameter specifies whether Historical Server must delete the input session(s) after successfully creating a new session. The choices are:
SMC_HS_DELETE_FILES
SMC_HS_RETAIN_FILES
This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.
if playbackTarget is SMC_HS_TARGET_FILE, this parameter must be a pointer to a variable of type SMC_SESSION_ID, into which the Monitor Client Library writes the identifier for the new session.
This parameter is ignored if playbackTarget is SMC_HS_TARGET_CLIENT.
Return value |
Indicates |
---|---|
SMC_RET_SUCCESS |
Function succeeded. |
SMC_RET_FAILURE |
Function failed. |
SMC_RET_INVALID_CONNECT |
Connection does not exist. |
This example assumes that you have created a connection to Historical Server and have a clientId.
SMC_SESSION_ID inputSessions[2];
if (smc_create_playback_session(clientId, inputSessions, 2,/* number of input sessions */ "",/* default start time */ "",/* default end time */ SMC_HS_PBTYPE_INTERVAL,/* summarize at */ 60,/* uniform minute intervals */ SMC_HS_ESTIM_ALLOW,/* allow estimation */ SMC_HS_MISSDATA_SHOW, /* produce a sample*/ /* every minute even if no data is */ /* available for that interval */ SMC_HS_TARGET_CLIENT, /* do playback */ "",/* directory name */ SMC_HS_SESS_PROT_PUBLIC,/* so next 5 */ SMC_HS_SESS_SCRIPT_SYBASE,/* are */ SMC_HS_DELETE_FILES,/* unused */ NULL)/* No output session ID */ != SMC_RET_SUCCESS) {
printf("smc_create_playback_session failed\n"); /* do some cleanup */ }
In a Historical Server connection, recording sessions and playback sessions are mutually exclusive. An application that connects to a Historical Server and defines a recording session, must complete the definition of the recording session using the function smc_initiate_recording before creating a playback session.
If the playbackType is SMC_HS_PBTYPE_RAW, the application can specify only one input session. Otherwise, the application can specify any number of input sessions (but at least one), provided that all sessions were recorded against the same Adaptive Server installation and Monitor Server.
If the playbackType is SMC_HS_PBTYPE_RAW, different rules apply to the definition of playback views. Refer to the Adaptive Server Enterprise Monitor Historical Server User’s Guide for more information about views.
You cannot combine playbackTarget SMC_HS_TARGET_FILE with playbackType SMC_HS_PBTYPE_RAW or SMC_HS_PBTYPE_ACTUAL.
Input sessions can include recording sessions that are still in the process of recording, unless playbackTarget is SMC_HS_TARGET_FILE.
If playbackTarget is SMC_HS_TARGET_FILE, then the input session must contain performance data for the entire time from startTime to endTime, with no gaps between input sessions.
Refer to the Monitor Historical Server User’s Guide for more information about the hs_create_playback_session command.
Mode |
Availability |
---|---|
SMC_SERVER_M_LIVE |
No |
SMC_SERVER_M_HISTORICAL |
Yes |
Error |
Indicates |
---|---|
SMC_RET_INTERNAL_ERROR |
Internal error |
SMC_INVALID_SVR_MODE |
Invalid server mode |
smc_initiate_playback