If I am trying to get the run time of a program how do you "lock" an ASSIGNMENT?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • If I am trying to get the run time of a program how do you "lock" an ASSIGNMENT?

    If I am trying to get the run time of a program how do you "lock" an ASSIGNMENT?

    If I code.................at the start of the program:

    ASSIGN/START_TIME=(INT(SYSTEMTIME("H")*3600)+INT(SYSTEMTI ME("mm")*60)+INT(SYSTEMTIME("ss")))/60

    If I code.................at the end of the program:

    ASSIGN/END_TIME=(INT(SYSTEMTIME("H")*3600)+INT(SYSTEMTIME ("mm")*60)+INT(SYSTEMTIME("ss")))/60
    ASSIGN/PROGRAM_RUN_TIME=END_TIME-START_TIME

    This just equals 0 because the START_TIME and END_TIME keep going up and up and are equal..........so how do I lock them?

  • #2
    Some code I wrote awhile ago

    Code:
    [COLOR=#000000]$$ NO,**** CODE TO CALCULATE RUNTIME *****[/COLOR]$$ NO,**** OUTPUTS AS    HR:MN:SEC    *****
    $$ NO,**** ASSUME PROGRAM RUNS NO MORE THAN 2 DAYS *****
    
    $$ NO,***************************************************
                ASSIGN/START_HOUR = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("H")
                ASSIGN/START_MINUTE = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("m")
                ASSIGN/START_SECOND = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("s")
    
    $$ NO,***************************************************
                ASSIGN/START_DAY = SYSTEMDATE("d")
                ASSIGN/START_MONTH = SYSTEMDATE("M")
                ASSIGN/START_YEAR = SYSTEMDATE("yyyy")
    
    
    
    
    $$ NO,*******************************************
    $$ NO,****** YOUR PROGRAM CODE ******
    $$ NO,*******************************************
    
    
    
    
                ASSIGN/END_DAY = SYSTEMDATE("d")
                ASSIGN/END_MONTH = SYSTEMDATE("M")
                ASSIGN/END_YEAR = SYSTEMDATE("yyyy")
    
    $$ NO,***************************************************
                ASSIGN/END_HOUR = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("H")
                ASSIGN/END_MINUTE = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("m")
                ASSIGN/END_SECOND = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("s")
       
    $$ NO,****** FIRST *****
    $$ NO,****** TEST FOR SAME DAY *****
    $$ NO,****** ASSUMING ONLY 1 DAY AFTER START OF MEASUREMENT *****
                IF/START_DAY <> END_DAY
                ASSIGN/END_HOUR = END_HOUR+24
                END_IF/
    
    $$ NO,****** NEXT *****
    $$ NO,****** TEST FOR SECONDS *****
                IF/END_SECOND >= START_SECOND
        ASSIGN/SECONDS_RUN = (END_SECOND-START_SECOND)
                GOTO/L1
                END_IF/
    
                IF/END_SECOND < START_SECOND
                ASSIGN/END_SECOND = END_SECOND+60
                ASSIGN/END_MINUTE = END_MINUTE-1
        ASSIGN/SECONDS_RUN = (END_SECOND-START_SECOND)
        GOTO/L1
                END_IF/
    
    L1         =LABEL/
    
    $$ NO,****** NEXT *****
    $$ NO,****** TEST FOR MINUTES *****
                IF/END_MINUTE >= START_MINUTE
                ASSIGN/MINUTES_RUN = (END_MINUTE-START_MINUTE)
                GOTO/L2
                END_IF/
    
                IF/END_MINUTE < START_MINUTE
                ASSIGN/END_MINUTE = END_MINUTE+60
                ASSIGN/END_HOUR = END_HOUR-1
                ASSIGN/MINUTES_RUN = (END_MINUTE-START_MINUTE)
                ASSIGN/HOURS_RUN = (END_HOUR-START_HOUR)
                 END_IF/
    
    L2         =LABEL/
     
    $$ NO,****** NEXT *****
                ASSIGN/HOURS_RUN = (END_HOUR-START_HOUR)
    
    $$ NO,***************************************************
                ASSIGN/RUN_TIME = (HOURS_RUN+":"+MINUTES_RUN+":"+SECONDS_RUN)
    $$ NO,***************************************************
                COMMENT/OPER,YES,***************************************************
                                ,"PROGRAM RUNTIME ==> " +RUN_TIME
                                ,***************************************************

    feel free to change it to suit your needs.

    B&S CHAMELEON/PCDMIS CAD++ V2011

    There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

    sigpic

    Comment


    • #3
      Originally posted by dph51 View Post
      Some code I wrote awhile ago

      Code:
      [COLOR=#000000]$$ NO,**** CODE TO CALCULATE RUNTIME *****[/COLOR]$$ NO,**** OUTPUTS AS    HR:MN:SEC    *****
      $$ NO,**** ASSUME PROGRAM RUNS NO MORE THAN 2 DAYS *****
      
      $$ NO,***************************************************
                  ASSIGN/START_HOUR = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("H")
                  ASSIGN/START_MINUTE = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("m")
                  ASSIGN/START_SECOND = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("s")
      
      $$ NO,***************************************************
                  ASSIGN/START_DAY = SYSTEMDATE("d")
                  ASSIGN/START_MONTH = SYSTEMDATE("M")
                  ASSIGN/START_YEAR = SYSTEMDATE("yyyy")
      
      
      
      
      $$ NO,*******************************************
      $$ NO,****** YOUR PROGRAM CODE ******
      $$ NO,*******************************************
      
      
      
      
                  ASSIGN/END_DAY = SYSTEMDATE("d")
                  ASSIGN/END_MONTH = SYSTEMDATE("M")
                  ASSIGN/END_YEAR = SYSTEMDATE("yyyy")
      
      $$ NO,***************************************************
                  ASSIGN/END_HOUR = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("H")
                  ASSIGN/END_MINUTE = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("m")
                  ASSIGN/END_SECOND = [COLOR=#FF0000][B]SYSTEMTIME[/B][/COLOR]("s")
         
      $$ NO,****** FIRST *****
      $$ NO,****** TEST FOR SAME DAY *****
      $$ NO,****** ASSUMING ONLY 1 DAY AFTER START OF MEASUREMENT *****
                  IF/START_DAY <> END_DAY
                  ASSIGN/END_HOUR = END_HOUR+24
                  END_IF/
      
      $$ NO,****** NEXT *****
      $$ NO,****** TEST FOR SECONDS *****
                  IF/END_SECOND >= START_SECOND
          ASSIGN/SECONDS_RUN = (END_SECOND-START_SECOND)
                  GOTO/L1
                  END_IF/
      
                  IF/END_SECOND < START_SECOND
                  ASSIGN/END_SECOND = END_SECOND+60
                  ASSIGN/END_MINUTE = END_MINUTE-1
          ASSIGN/SECONDS_RUN = (END_SECOND-START_SECOND)
          GOTO/L1
                  END_IF/
      
      L1         =LABEL/
      
      $$ NO,****** NEXT *****
      $$ NO,****** TEST FOR MINUTES *****
                  IF/END_MINUTE >= START_MINUTE
                  ASSIGN/MINUTES_RUN = (END_MINUTE-START_MINUTE)
                  GOTO/L2
                  END_IF/
      
                  IF/END_MINUTE < START_MINUTE
                  ASSIGN/END_MINUTE = END_MINUTE+60
                  ASSIGN/END_HOUR = END_HOUR-1
                  ASSIGN/MINUTES_RUN = (END_MINUTE-START_MINUTE)
                  ASSIGN/HOURS_RUN = (END_HOUR-START_HOUR)
                   END_IF/
      
      L2         =LABEL/
       
      $$ NO,****** NEXT *****
                  ASSIGN/HOURS_RUN = (END_HOUR-START_HOUR)
      
      $$ NO,***************************************************
                  ASSIGN/RUN_TIME = (HOURS_RUN+":"+MINUTES_RUN+":"+SECONDS_RUN)
      $$ NO,***************************************************
                  COMMENT/OPER,YES,***************************************************
                                  ,"PROGRAM RUNTIME ==> " +RUN_TIME
                                  ,***************************************************

      feel free to change it to suit your needs.
      Many thanks dph51 - I'll try that

      Comment


      • #4
        The code from DPH51 is good, but I am not sure there is anything wrong with your code either. Please elaborate. What do you mean they keep going up and up? When I use your code in my program, it works fine. About how long does it take to run the section between these 2 statements?

        There was an issue long ago, where you could place start and end time statements around the program, and the would report the same. That was because the processor application would look at the two and believe they did not depend on anything else in the program so it would run those without waiting. We found that you need to at least add a dimension callout before the End calculation, it would be forced to wait before performing that calculation. That was long ago, and I believe it has since changed. I am interested to know what you are experiencing.

        Comment


        • #5
          Originally posted by Don Ruggieri View Post
          The code from DPH51 is good, but I am not sure there is anything wrong with your code either. Please elaborate. What do you mean they keep going up and up? When I use your code in my program, it works fine. About how long does it take to run the section between these 2 statements?

          There was an issue long ago, where you could place start and end time statements around the program, and the would report the same. That was because the processor application would look at the two and believe they did not depend on anything else in the program so it would run those without waiting. We found that you need to at least add a dimension callout before the End calculation, it would be forced to wait before performing that calculation. That was long ago, and I believe it has since changed. I am interested to know what you are experiencing.
          I believe the program should take about 30 mins or so.

          I've got about 2 dozen toleranced dimensions.

          If I hover the cursor over my original versions of the START and END statements I can see the numbers going up and up and up - and that they're the exact same....................like it's giving me "what time is it now" instead of what time was it when these lines were ran.

          Comment


          • #6
            Originally posted by joseq7 View Post
            If I hover the cursor over my original versions of the START and END statements I can see the numbers going up and up and up - and that they're the exact same....................like it's giving me "what time is it now" instead of what time was it when these lines were ran.
            Hovering seems to evaluate the right hand expression, not fetching the left hand variable. What is the result of PROGRAM_RUN_TIME at the end of run (COMMENT/OPERATOR ...).
            AndersI
            SW support - Hexagon Metrology Nordic AB

            Comment


            • #7
              Originally posted by joseq7 View Post
              If I am trying to get the run time of a program how do you "lock" an ASSIGNMENT?

              If I code.................at the start of the program:

              ASSIGN/START_TIME=(INT(SYSTEMTIME("H")*3600)+INT(SYSTEMTI ME("mm")*60)+INT(SYSTEMTIME("ss")))/60

              If I code.................at the end of the program:

              ASSIGN/END_TIME=(INT(SYSTEMTIME("H")*3600)+INT(SYSTEMTIME ("mm")*60)+INT(SYSTEMTIME("ss")))/60
              ASSIGN/PROGRAM_RUN_TIME=END_TIME-START_TIME

              This just equals 0 because the START_TIME and END_TIME keep going up and up and are equal..........so how do I lock them?
              If you hover over them in your program, they will equal "0". But it is when you execute your program that it should take in effect.

              Add this to your program after the ASSIGN/PROGRAM_RUN_TIME=END_TIME-START_TIME

              Code:
               
              COMMENT/REPT,
                          "TOTAL PROGRAM RUNTIME (IN DECIMAL MINUTES): "+PROGRAM_RUN_TIME

              Comment


              • #8
                Originally posted by bfire85 View Post
                If you hover over them in your program, they will equal "0". But it is when you execute your program that it should take in effect.

                Add this to your program after the ASSIGN/PROGRAM_RUN_TIME=END_TIME-START_TIME

                Code:
                 
                COMMENT/REPT,
                            "TOTAL PROGRAM RUNTIME (IN DECIMAL MINUTES): "+PROGRAM_RUN_TIME
                Yes - that's now working correctly.

                As suggested you need to run the program to it's conclusion to get the "locked" assignment values.

                Many thanks to all who have replied to my OP.

                Comment

                Related Topics

                Collapse

                Working...
                X