Jay Harris's blog on coding .Net, automation, and improving quality through code. RSS 2.0
 Tuesday, May 10, 2005

For my needs, the biggest hole in Mercury LoadRunner is its lack of page size monitoring. LoadRunner can monitor anything else imaginable, including transaction counts, transaction times, errors, and all Windows Performance Monitor metrics. However, monitoring page size, download times, and HTTP Return codes are only available through programming.

The following function will monitor the page size of all responses, logging an error if it exceeds you specified limit, as well as track all values on the user-defined graphs.

Begin Code:

si_page_size_limit(int PageLimit, char* PageName, char *PageURL, long TransactionID){

//

// Page Size Limit Monitor

// Author: Cpt. LoadTest

// Created: 10-Aug-2004

// Last Modified: 10-May-2005, Cpt. LoadTest

//

// Description:

// Logs an error to the log, pass or fail, including the applicable status, if logging is enabled.

// Plots page size datapoint to User Defined graph.

//

// Inputs:

// int PageLimit Maximum page size allowed, in bytes

// char* PageName Name of the page, such as the Title. For identification in logs.

// char* PageURL URL of the page. For reference in logs. FOr identification in logs.

// long TransactionID Transaction ID for the current request.

// Note: Transaction must be explicitly opened via lr_start_transaction_instance.

// Note: TransactionID is returned by lr_start_transaction_instance.

//

 

    int iPageSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

    char DataPointName[1024] = “Response Size [”;

    strcat(DataPointName, PageName);

    strcat(DataPointName, “]”);

 

    if (PageLimit < iPageSize) {

        lr_continue_on_error(1);

        lr_debug_message(LR_MSG_CLASS_BRIEF_LOG | LR_MSG_CLASS_EXTENDED_LOG, “Page Size Check FAILED - %s [%s] exceeds specified page size limit of %d (Total: %d)”,PageName,PageURL,PageLimit,iPageSize);

        lr_continue_on_error(0);

    } else {

        lr_debug_message(LR_MSG_CLASS_BRIEF_LOG | LR_MSG_CLASS_EXTENDED_LOG, “Page Size Check PASSED - %s [%s] meets specified page size limit of %d (Total: %d)”,PageName,PageURL,PageLimit,iPageSize);

    }

    if (lr_get_trans_instance_status(TransactionID) == LR_PASS) {

        lr_user_data_point_instance_ex(DataPointName,iPageSize,TransactionID,DP_FLAGS_EXTENDED_LOG);

    }

    return 0;

}

Tuesday, May 10, 2005 1:51:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Performance | Testing
Navigation
Lansing Day of .Net, 21 June 2008 - I'll be there!
Archive
<May 2005>
SunMonTueWedThuFriSat
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234
Other Blogs I Read
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Jason Harris
Sign In
Statistics
Total Posts: 68
This Year: 8
This Month: 1
This Week: 0
Comments: 1
All Content © 2008, Jason Harris
DasBlog theme 'Business' created by Christoph De Baene (delarou)