Jump to content

$fileWrite delayed


Recommended Posts

What line 26???

$file = FileOpen("logfile_" &@MDAY &@MON &@HOUR &@MIN &"_" &$ip[$x] & ".txt", 9)
        If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf

        FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
FileClose($file)
Edited by diikee
Link to comment
Share on other sites

Any chance of a sample logfile? just make the IP 123.123.123.123 or something.... muttley

Well using this script as my test:

Dim $ip[1] = ["123.123.123.123"]
$x = 0

$file = FileOpen("logfile_" & @MDAY & @MON & @HOUR & @MIN & "_" & $ip[$x] & ".txt", 9)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
FileClose($file)

The logfile outputs:

SQA Testing IP#: 123.123.123.123
SQA Testing Finished at: 190720080929

Exactly what you told the code to add... Is there something I'm missing?

Edited by Bert
Link to comment
Share on other sites

Yes, I am getting the log file populated as the test goes through all the cases.

Problem is the Console is printing faster than the log file is been written to. Thus, ending up with a partial log.

either the writefile is lagging behind or something.

so, is there a way to enhance the writefile command to flush data to the file from the buffer faster??

Link to comment
Share on other sites

Yes, I am getting the log file populated as the test goes through all the cases.

Problem is the Console is printing faster than the log file is been written to. Thus, ending up with a partial log.

either the writefile is lagging behind or something.

so, is there a way to enhance the writefile command to flush data to the file from the buffer faster??

I'm testing now, with the following:

Dim $ip[1] = ["123.123.123.123"]
$x = 0

For $i = 1 To 1000
$file = FileOpen("logfile_" & @MDAY & @MON & @HOUR & @MIN & "_" & $ip[$x] & ".txt", 9)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
FileClose($file)
Next

No missed beats. My output file has 2000 lines, exactly how many there should be.

But, thats only 1 IP, and 1 Log. Now for 1000 Logs!

$output = ""
For $i = 1 To 1000
    $ip = Round (Random (100, 999),0) & "." & Round (Random (100, 999),0) & "." & Round (Random (100, 999),0) & "." & Round (Random (100, 999),0)
    $file = FileOpen("logfiles\logfile_" & @MDAY & @MON & @HOUR & @MIN & "_" & $ip & ".txt", 9)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf

    FileWrite($file, "SQA Testing IP#: " & $ip & @CRLF)
    FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
    FileClose($file)
Next

Still all there, all the same size too.... There must be another part to your code thats causing this IMO. Otherwise maybe add a sleep here and there, so it catches up.... muttley

EDIT: 100 logs? Pfft... I meant 1000! *Evil Laughter*

EDIT 2: Why not test time while we're at it. This took 1584ms to execute 1000 logs. For 10,000 it took 17939ms. Both cases had the correct number of files. I still draw to my same conclusion that something else is causing this.

$timer = TimerInit ()
$output = ""
For $i = 1 To 1000
    $ip = Round (Random (100, 999),0) & "." & Round (Random (100, 999),0) & "." & Round (Random (100, 999),0) & "." & Round (Random (100, 999),0)
    $file = FileOpen("logfiles\logfile_" & @MDAY & @MON & @HOUR & @MIN & "_" & $ip & ".txt", 9)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf

    FileWrite($file, "SQA Testing IP#: " & $ip & @CRLF)
    FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
    FileClose($file)
Next
ClipPut (TimerDiff ($timer))
Edited by Bert
Link to comment
Share on other sites

Log file has:

Electronic Shutter is set to: fixed 1/6144 sec

Electronic Shutter is set to: fixed 1/4096 sec

Electronic Shutter is set to: fixed 1/2560 sec

Electronic Shutter is set to: fixed 1/2048 sec

Electronic Shutter is set to: fixed 1/1396 sec

Electronic Shutter is set to: fixed 1/960 sec

Electronic Shutter is set to: fixed 1/698 sec

Electronic Shutter is set to: fixed 1/480 sec

Electronic Shutter is set to: fixed 1/349 sec

Electronic Shutter is set to: fixed 1/240 sec

Electronic Shutter is set to: fixed 1/175 sec

Electronic Shutter is set to: fixed 1/120 sec

Electronic Shutter is set to: fixed 1/60 se

Console has:

Electronic Shutter is to: fixed 1/6144 sec

Electronic Shutter is to: fixed 1/4096 sec

Electronic Shutter is to: fixed 1/2560 sec

Electronic Shutter is to: fixed 1/2048 sec

Electronic Shutter is to: fixed 1/1396 sec

Electronic Shutter is to: fixed 1/960 sec

Electronic Shutter is to: fixed 1/698 sec

Electronic Shutter is to: fixed 1/480 sec

Electronic Shutter is to: fixed 1/349 sec

Electronic Shutter is to: fixed 1/240 sec

Electronic Shutter is to: fixed 1/175 sec

Electronic Shutter is to: fixed 1/120 sec

Electronic Shutter is to: fixed 1/60 sec

Electronic Shutter is to: fixed 1/40 sec

Electronic Shutter is to: fixed 1/30 sec

Electronic Shutter is to: fixed 1/20 sec

Electronic Shutter is to: fixed 1/15 sec

Electronic Shutter is to: fixed 1/11 sec

Electronic Shutter is to: fixed 1/8 sec

Electronic Shutter is to: fixed 1/5 sec

what is the problem??

You haven't given us any code that writes a log file like that. So we can't see the problem. Post a short reproducer script that we can run to see the problem. If you can't, it must your Reality Distortion Field (RDF)... hang out with Steve Jobs much?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...