Creates a view that can contain one or more data items. For information about data items, refer to Chapter 2, “Data Items and Statistical Types”.
You can use the smc_create_view function with both Monitor Server and Historical Server. When used with Historical Server (SMC_SERVER_M_HISTORICAL), it creates a view for the recording or playback session that is being defined.
SMC_RETURN_CODE smc_create_view (SMC_CONNECT_ID clientId, SMC_DATAITEM_STRUCTP dataItemListHandle, SMC_SIZET dataItemListLength, SMC_CHARP viewName, SMC_VIEW_IDP viewIdHandle)
identifies the connection.
pointer to array of SMC_DATAITEM_STRUCTs.
number of data items in the array pointed to by the dataItemListHandle.
null-terminated string containing a descriptive name for this view. This name can include a – z, A – Z, 0 – 9, and underscore (_) characters, or can be NULL.
Used only for a Historical Server connection. For a live connection, the view name is ignored.
pointer to a variable, which should be declared as type SMC_VIEW_ID. If the call to smc_create_view succeeds, this variable contains the ID for the view.
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 and have a clientId.
SMC_DATAITEM_STRUCT dataItem = { SMC_NAME_PAGE_LOGICAL_READ, SMC_STAT_VALUE_SAMPLE }; SMC_DATAITEM_STRUCTP dataItemHandle = &dataItem; SMC_VIEW_ID viewId; SMC_VIEW_IDP viewHandle = &viewId;
if (smc_create_view(clientId, dataItemHandle, 1, /* just one dataItem */ NULL, /* this is a Monitor Server view */ viewIdHandle) != SMC_RET_SUCCESS) { printf("smc_create_view failed\n"); /* do some cleanup */ }
Refer to Chapter 2, “Data Items and Statistical Types” for rules for using views with live views.
When called against a Historical Monitor connection, smc_create_view must be preceded by a call to smc_create_recording_session or smc_create_playback_session.
When used in Historical Server during the definition of a recording session, it defines a view to be recorded by Historical Server during the recording session.
When used in Historical Server during a playback session, it selects a view for playback from those previously recorded in recording session(s). If the playback session uses more than one input session, then the selected view must exist in all input sessions and use the same name, data items, and filters.
Depending on whether the playback session was created for “raw” or summarizing playback, the playback view may or may not include certain data items from the original view. Refer to the Adaptive Server Enterprise Monitor Historical Server User’s Guide for more information on the hs_create_playback_view command.
Mode |
Availability |
---|---|
SMC_SERVER_M_LIVE |
Yes |
SMC_SERVER_M_HISTORICAL |
Yes |
Error |
Indicates |
---|---|
SMC_RET_INVALID_API_FUNC_SEQUENCE |
Invalid calling sequence of Monitor Client Library functions |
SMC_RET_INVALID_DINAME |
Invalid data item |
SMC_RET_INVALID_DI_STATTYPE |
Invalid data item statistic type |
SMC_RET_INSUFFICIENT_MEMORY |
Insufficient memory |
smc_create_recording_session, smc_create_playback_session, smc_initiate_recording, smc_initiate_playback, smc_drop_view