SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Nov 2003
    Location
    virginia
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to get time taken for a query in millisecons

    Hi this is my first post here. I am using this script to calculate time taken for the query. But if time is less than a secon then I am getting 0 sec. Please let me know how I can calculate time in millisecons.

    db_connect("query1","DRIVER= {ORACLE ODBC DRIVER};SERVER=xxxx;UID=xxxx;PWD=xxxx;");
    start1 = get_time();
    start2 = time_str();
    db_execute_query("query1","select * from xxxx",record_number);
    db_get_headers("query1",field_num,headers);

    end1 = get_time();
    end2 = time_str();

    printf("start timevalue of get_time= %s and time_str = %s", start1,start2);
    printf("end timevalue of get_time= %s and time_str = %s", end1,end2);
    printf("time taken to execute the queries is %d sec", end1-start1);

    db_disconnect(query1);

  2. #2
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to get time taken for a query in millisecons

    load_dll("Kernel32.dll");
    extern int GetTickCount();

    db_connect("query1","DRIVER= {ORACLE ODBC DRIVER};SERVER=xxxx;UID=xxxx;PWD=xxxx;");
    start2 = time_str();
    start1 = GetTickCount();
    db_execute_query("query1","select * from xxxx",record_number);

    end1 = GetTickCount();
    end2 = time_str();

    db_get_headers("query1",field_num,headers);
    printf("start timevalue of GetTickCount = %d and time_str = %s", start1,start2);
    printf("end timevalue of GetTickCount = %d and time_str = %s", end1,end2);
    printf("time taken to execute the queries is %d milliseconds", end1-start1);

    db_disconnect(query1);

  3. #3
    Moderator
    Join Date
    Aug 2001
    Location
    NC
    Posts
    6,018
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: How to get time taken for a query in millisecons

    Try the transaction API (start..end...). Granularity is milliseconds. Define a named transaction and go to town.

    'Pulley
    James Pulley

    Replace ineffective offshore contracts, LoadRunnerByTheHour. Starting @ $19.95/hr USD.

    Put us to the test, skilled expertise is less expensive than you might imagine.

    Twitter: @LoadRunnerBTH @PerfBytes

  4. #4
    Junior Member
    Join Date
    Nov 2003
    Location
    virginia
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to get time taken for a query in millisecons

    Thank you verymuch bpolitzer and james pulley.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:39 AM.

Copyright BetaSoft Inc.