Scripting > CygNet Scripting Guide > HyperPoint Scripting > HSS Profiling

HSS Profiling

HSS profiling is used to assist with troubleshooting HyperPoint Scripts in the CygNet HyperPoint Scripting Service (HSS). HSS profiling allows scripts to report their events to an individual log file that is separate from the HSS service log file.

Enabling HSS Profiling

To use HSS profiling, you must enable the LOGMASK_SCRIPT keyword in the HSS configuration file (Hss.cfg) and add the desired profile option(s) from the table below. After saving the Hss.cfg file, stop and restart the service for the change to become effective, since the service reads the file only at startup.

For more information about modifying the HSS configuration file, see Service Configuration Files.

LOGMASK_SCRIPT Keyword Option Description

MIN_TRACE

Enables basic debug logging mode.

MAX_TRACE

Enables verbose debug logging mode.

PROFILE_MIN

Enables minimum performance profile logging mode. Displays the end time of an item coming out of scope or completing runtime.

PROFILE_MAX

Enables maximum performance profile logging mode. Displays the begin and end time of items coming in or out of scope.

Point Configuration

The HyperPoint features for a point must be enabled for a point to use the HSS scripting methods. See Creating and Configuring a HyperPoint for more information.

  1. Open the PNT Editor for the selected point.
  2. On the General page, click Edit.
  3. Select the HyperPoint check box to indicate that the point is a HyperPoint. This will cause the HyperPoint page to appear in the dialog box.
  4. Select the Activate script check box. Activate script must be enabled for scripting on the point to be active.
  5. Select the HyperPoint page for the point to be configured.
  6. Under HyperPoint setup, select the HyperPoint type from the drop-down menu. See PNT Editor - HyperPoint Page for more information.
  7. The Script text section displays the script currently contained in the HyperPoint. Click Edit to display the script editor to create custom script event options for the selected point. The event options available in the script editor event drop-down menu are OnInitializeEx, OnPointChange, OnTerminateEx, and OnTimer. For more information, see HyperPoint Events.
  8. The Simulation test section contains the simulation controls. To test the script, use these controls (Run, Pause, Stop, and Clear Status) before putting the script to use.

Note: The Current Value Service of the point must be a service for which scripting is enabled.

Log Manager Methods

In the script editor, the following methods can be used with the available event options to assist with profiling options. See LogManager Methods for more information.

LogManager Method Description

LogManager.GetProfiler("message")

The GetProfiler method writes a profile message to the scripting log file. Returns an object that logs a profile timing message on creation and deletion (object goes in or out of scope). On creation PROFILE_MAX must be set and on deletion (object goes out of scope) PROFILE_MIN must be set.

LogManager.LogAll("message")

The LogAll method writes the message string to the scripting log file.

LogManager.LogMin("message")

The LogMin method writes the message string to the scripting log file if MIN_TRACE is set in the HSS service configuration file.

LogManager.LogMax("message")

The LogMax method writes the message string to the scripting log file if MAX_TRACE is set in the HSS service configuration file.

Back to top

Logging the HSS Profile Data

Output of the script is captured and displayed in log file(s) located in the working HSS service directory. The HSS profile log files are generated separately from the HSS service log file to keep the profiling items and the HSS service items separate.

The HSS profiling log file is created automatically and follows the log file naming convention below. The HSS service log file's naming convention is also shown to illustrate the difference.

HSS Profiling Log File

The log file is <service_name>_Script<sequence_number>. log, where <service_name> is the name of the service.

Example: HSS_Script001.log

HSS Service Log File

The HSS service log file is used to capture and trace items on the HSS service. It follows the naming convention below.

Example: HSS001.log

Reading Profile Log Files

Log files, located in the HSS service folder, can be viewed by double clicking on the log file.

CygNet also has a utility that is designed to ease the view of displaying items in a log file. The Log File Viewer utility, located in the CygNet\Utilities directory, allows you to open, print, and search/filter for data within any log file to assist or aid in troubleshooting.

Troubleshooting HSS Scripts

The generated HSS profile log files can assist in troubleshooting HSS scripts. For example, if the Hss.cfg file is configured with the minimal log settings (MIN_TRACE) to capture only the basic debug items, but the scripting method contains both LogMin and LogMax items in the HyperPoint, only the minimal information will be collected in the HSS_Script001.log file due to the settings in the Hss.cfg file.

The following is an example section of an HSS Script with both LogManager.LogMin and LogManager.LogMax configured.

LogManager.LogMin("Begin OnInEx Log Min(LogMin)")

 

LogManager.LogMax("Begin OnInEx Log Max(LogMax)")

 

points.AddPoint "MYSITE.HSS::TEST.TESTUDC", this

points.AddPoint "MYSITE.HSS::TEST.TESTUDC2"

 

This.Value = "Init end"

To collect more logging data to troubleshoot the HSS script for the point in question, you could add PROFILE_MIN and PROFILE_MAX to the existing LOGMASK_SCRIPT keyword in the Hss.cfg file, save the file, and restart the HSS service for the changes to take effect. Logging would then be enabled to display maximum logging to assist in troubleshooting, without editing any HSS HyperPoint scripts. The additions will create entries in the log file at the start of a script runtime (in scope) and at the end time of a script runtime (out of scope).

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.