Zentitle SDK and Library
NSATest Looping test for Analytics

NSATest is a command line tool built for cross-platform testing without the need for a UI or an application. We recommend NSATest testing for you initial, quick testing. It will help you to understand how analytics is collected and give you an idea of the resources used and the time required to do so.

The NSATest is built upon the Nilm framework. When run, it will display some information about the library then proceed to

NSATest will repeatedly collect the above data points for the number of loops specified. At the end of each loop information about the time spent collecting and sending the data to Nalpeiron will be reported. Addtionally, internal resource usage of the library will be displayed.

Parameters

Command Type Description
Auth1, Auth2, Auth3 uint The authentication values you picked at lib creation
noLoops uint Number of times to test loop (where applicable)
Pause1 and Pause3 uint in seconds For testing (pause1 is after NalpLibOpen,
pause2 is just before NalpLibClose)
ApLang string Specify system language
BuildEdition string Specify a build edition for analytics
BuildNumber string Specify a build number for analytics
BuildVersion string Specify a build version for analytics
CustomerID uint Last 5 digits of your customer ID number
Description string Specify a descriptive string for analytics
ExceptionCode string Specify an exception code for analytics
FeatureCode string A feature code OR udf code OR element pool code
PoolAmount uint Element pool amount
Library string /path/to/library.so
LicenseCode string License code
NSALicenseStatus string License status for analytics collection
ProductID number uint Last 5 digits of your product ID number
Username username string username
Password password string password
NSAPrivacy 0, 1 Analytics privacy setting
NSLCertificate string An activation certificate or path to
file containing certificate
NSLRegistration string XML fragment containing registration information
NSAClientData string XML fragment containing addition client data
NalpErrorNo int Nalpeiron library error number
TransactionID uint Used to group analytics informatio
CacheQLen uint Length in bytes of analytics cache file
DaemonIP string Daemon's ip address
DaemonPort uint Daemon's port number
DaemonUser username string Username for daemon contact
DaemonPass password string Password for daemon contact
LogSize uint Max size of log file in bytes
WorkDir string /workdir/path
LogLevel 0,1,2,3,4 0 is off, 4 is full debug
LogQLen uint length (in number of messages) of log queue
OfflineMode 0, 1 Disable or Enable offline mode
ProxyIP string IP address of intervening proxy
ProxyPort uint Port number of intervening proxy
ProxyPass string Password for intervening proxy
ProxyUser string Username for intervening proxy
SoapThMin uint Min number of threads for analytics data
SoapThMax uint Max number of threads for analytics data
WorkGroup string Group name for WorkDir ownership
NSAEnable 0, 1 Disable or Enable Analytics library (NSA)
NSLEnable 0, 1 Disable or Enable Licensing library (NSL)

NSATest Example

./nsaTest --Library /tmp/test30.so --LogLevel 4 --WorkDir /tmp --NSAEnable 1 --CustomerID 12345 --productID 12345 --NSAPrivacy 0 --LogQLen 300 --CacheQLen 25 --SoapThMin 10 --SoapThMax 10 --LogSize 0 --Pause1 1 --Pause2 3 --Pause3 10 --noLoops 10 --Username nalpUser --ApLang english --BuildEdition 5 --NSALicenseStatus statusString --BuildVersion buildVerString --BuildNumber buildNumString --FeatureCode FEAT3 --ExceptionCode division_by_zero --Description an_error --NSAClientData clientDataString

Let's break some of these parameters down:

Library, LogLevel, WorkDir, NSAEnable, and NSLEnable are all standard parts of the library's intialization routines. Library specifies the location of the Nalpeiron licensing and analytics library on your system. NSLEnable and NSAEnable enable the licensing and the analytics portions of the library respectively. You can enable one or the other or both when initialization the library. WorkDir specifies the location where the library will store the files it requires to operate.

CustomerID, ProductID, and NSAPrivacy are parameters that would normally be set by or hard coded into your program. Here they are passed in as paramters.

LogQLen, LogSize, CacheQLen, SoapThMin, and SoapThMax are parameters that affect the library's internal operations. LogSize specifies the maximum size of the library's log file in bytes. When this size is reached, log file rollover commences, with no more than the most recent four log files kept. A LogSize of 0 means that the log file size is unlimited, with no log file rollover. LogQLen is the size of the library's internal queue for log messages. Log files are stored in a queue until the library can write them to disk. If the log file is full then log messages are dropped. CacheQLen set the size of the cache queue length. Analytics information is temporarily stored in a file until the system has time to transmit it to Nalpeiron. If the cache file is full, the library will drop analytics information until room becomes available. SoapThMax, SoapThMin are the minimum number and maximum number of thread available in the thread pool for connections to Nalperion. The library will tune itself and normally these values do not need to be set as the defaults are usually acceptable.

Username, ApLang, BuildEdition, NSALicenseStatus, BuildVersion, BuildNumber, FeatureCode, ExceptionCode, NSAClientData, and Description are all parameter values used by NSATest to call various functions from the NSA library.

Pause1, Pause2, and Pause3 are used to cause pauses in the NSATest program. As the program performs no other actions than opening the library, calling NSA functions and then closing the library for small numbers of loops pauses are needed. For instance, the library will transmit no analytics information to Nalpeiron until the server has been contacted and geographical location information is received back at the client. If we run a single loop without pause, it is possible that the geographical location information will not have time to return to the client. In this case, the library will write all analytics information to disk rather than transmit the information to Nalpeiron. These pauses help to alleviate the problem. Similar problems may occur with the test program for large analytics caches are sent to nalpeiron. Pause1 occurs immediately after NalpLibOpen, Pause2 occurs at the end of each loop, and Pause3 occurs just before NalpLibClose.

NSATest Output

1 Using library at /tmp/test30.so
2 
3 <?xml version="1.0" encoding="UTF-8"?>
4 <NSA Current Statistics>
5  <OfflineMode>0</OfflineMode>
6  <LocationInfo>0</LocationInfo>
7  <Cache Thread>
8  <Max Cache Que Len>25</Max Cache Que Len>
9  <Current Cache Que Len>0</Current Cache Que Len>
10  <Cache writes>0</Cache writes>
11  <Cache fails>0</Cache fails>
12  </Cache Thread>
13  <Soap Pool>
14  <Min Soap Threads>10</Min Soap Threads>
15  <Max Soap Threads>10</Max Soap Threads>
16  <Queued Jobs>0</Queued Jobs>
17  <Running Jobs>0</Running Jobs>
18  <Finished Jobs>0</Finished Jobs>
19  </Soap Pool>
20 </NSA Current Statistics>

The first output of the program is a statement indicating that the library has been validated using the customer ID and product ID passed in on the command line. The rest is NSAStats information.

1 The computer ID is: RXbew8g59J//1nTZkCDi
2 Hostname is my.nalpeiron.com
3 library is valid
4 Library Version: 3.2.82.0 NSA: 3.2.82.0
5 Starting loop 0 of 10: Complete in 3 msec
6 <?xml version="1.0" encoding="UTF-8"?>
7 <NSA Current Statistics>
8  <OfflineMode>0</OfflineMode>
9  <LocationInfo>1</LocationInfo>
10  <Cache Thread>
11  <Max Cache Que Len>25</Max Cache Que Len>
12  <Current Cache Que Len>0</Current Cache Que Len>
13  <Cache writes>8</Cache writes>
14  <Cache fails>0</Cache fails>
15  </Cache Thread>
16  <Soap Pool>
17  <Min Soap Threads>10</Min Soap Threads>
18  <Max Soap Threads>10</Max Soap Threads>
19  <Queued Jobs>0</Queued Jobs>
20  <Running Jobs>0</Running Jobs>
21  <Finished Jobs>10</Finished Jobs>
22  </Soap Pool>
23 </NSA Current Statistics>

The next information output by NSATest is various library information (computerID, Analytics hostname, version information, etc). The remaining statistics are from the end of its first loop through the NSA functions. The highlights

1 Starting loop 1 of 10: Complete in 2 msec
2 <?xml version="1.0" encoding="UTF-8"?>
3 <NSA Current Statistics>
4  <OfflineMode>0</OfflineMode>
5  <LocationInfo>1</LocationInfo>
6  <Cache Thread>
7  <Max Cache Que Len>25</Max Cache Que Len>
8  <Current Cache Que Len>0</Current Cache Que Len>
9  <Cache writes>8</Cache writes>
10  <Cache fails>0</Cache fails>
11  </Cache Thread>
12  <Soap Pool>
13  <Min Soap Threads>10</Min Soap Threads>
14  <Max Soap Threads>10</Max Soap Threads>
15  <Queued Jobs>0</Queued Jobs>
16  <Running Jobs>0</Running Jobs>
17  <Finished Jobs>17</Finished Jobs>
18  </Soap Pool>
19 </NSA Current Statistics>
20 
21 ...

The library continues to loop, updating and outputing information as it goes.

1 Starting loop 9 of 10: Complete in 2 msec
2 <?xml version="1.0" encoding="UTF-8"?>
3 <NSA Current Statistics>
4  <OfflineMode>0</OfflineMode>
5  <LocationInfo>1</LocationInfo>
6  <Cache Thread>
7  <Max Cache Que Len>25</Max Cache Que Len>
8  <Current Cache Que Len>0</Current Cache Que Len>
9  <Cache writes>8</Cache writes>
10  <Cache fails>0</Cache fails>
11  </Cache Thread>
12  <Soap Pool>
13  <Min Soap Threads>10</Min Soap Threads>
14  <Max Soap Threads>10</Max Soap Threads>
15  <Queued Jobs>0</Queued Jobs>
16  <Running Jobs>0</Running Jobs>
17  <Finished Jobs>73</Finished Jobs>
18  </Soap Pool>
19 </NSA Current Statistics>

The binary has completed all 10 loops. Note the total number of jobs is 73. This is 10 loops of 7 NSA call per loop. An eighth call, NSASysInfo, only occurs if the system information has changed, e.g. when you call NSASysInfo it will only send information to Nalpeiron if the system information has changed since the last call. In this case, that occurs in the first loop. So 70 calls + 1 NSASysInfo + 1 Location + 1 NSASendCache.