Profound.js performance logging



Starting in release 5.8.0, you can specify "plog=1" on the URL's that call Profound.js modules to enable performance logging for certain actions related to the calling of JS modules and ILE programs and service program procedures and other Profound.js internal tasks. Below is an example where a web service calls an RPG program, passing custnoIn as input, and gets back customer data custDataOut as an output data structure, which is converted to JSON and returned to the caller of the web service.

RPG program GETCUST:

Fcustadrp if e k disk * D custnoIn s 4s 0 * D custDataOut ds D custno 4s 0 D name 30 D street 30 D city 20 D state 2 D postal 10 * C *entry plist C parm custnoIn C parm custDataOut * C clear custDataOut C custnoIn chain custadrp C move *on *inlr C return



In Profound.js IDE, create workspace "testapp", then create this JS file "getcust.js". Mark it as an Express route with GET method.

function app(req, res) { pjs.define("custNoIn", {type: "zoned decimal", length: 4, decimals: 0}); pjs.define("custDataOut", { type: "data structure", qualified: true , elements: { "custno": { type: "zoned decimal", length: 4, decimals: 0 }, "name" : { type: "char", length: 30 }, "street": { type: "char", length: 30 }, "city" : { type: "char", length: 20 }, "state" : { type: "char", length: 2 }, "postal": { type: "char", length: 10 } } }); custNoIn = req.query.custno; pjs.call("TNPUI/GETCUST", custNoIn, custDataOut); // pass in "custnoIn", get back data structure "custDataOut" let dataOut = pjs.toObject(custDataOut); // convert data in data structure "custDataOut" to JS object res.json(dataOut); return; } exports.run = app;



Use this URL to call the web service, with "custno=1234" for the custnoIn parameter when passed to the RPG program, and "plog=1" to enable performance logging:

http://host:port/run/testapp/getcust?custno=1234&plog=1

The performance statistics are logged into a .csv log file. The name of the file is "plog_<PJS_session_number>.csv", where <PJS_session_number> is the Profound.js session number. Performance logging is collected for each Profound.js session. If running on IBM i and the server is started using STRTCPSVR, performance logs will be written to /profoundjs-base/instances/INSTANCE_NAME/logs on the IFS. Otherwise, performance logs will be written to a sub-directory 'logs' within the Profound.js installation directory.

In this example, the .csv file name is "plog_AFF474D55BEB246062FA4CA38D0CDBEA7A9C20F5CA818A93A6CC434A4322DD76.csv". You can open that file and save it as an .xlsx file. The data might look as shown below. Please send that to Profound Logic when requested for performance diagnostics.



When calling Profound.js modules from a Genie session:

When calling Profound.js modules from a Genie session, use "plog=1" as a Genie query string parameter when starting Genie sessions. In this case, the name of the log file will be "plog_jobNbr_jobUser_jobName.csv", where jobNbr/jobUser/JobName are the job information for the Genie session.