質問

I'm currently writing a program to shut down a computer when over a period of time (say, half an hour) network traffic is below a certain threshold.

Here's the pseudocode that I've worked will give the correct logic:

BEGIN SUBPROGRAM
    loopFlag = True
    Wait 5 minutes    # Allows time for boot and for the machine to settle
    traffic = 0
    WHILE loopFlag = True DO
        FOR sec = 0 to 3600
            traffic += *network.traffic()*
            wait 1 second
        ENDFOR
        IF traffic < trafficThreshold THEN
            loopFlag = False
        ENDIF
    ENDWHILE
    os.ShutDown()
END SUBPROGRAM

What I'm looking for is the Python module or library that will allow me to measure this.

Whilst I've done various research into this, these don't seem to be the sort of functionality I'm after, regardless of their language.

Any ideas on how to implement this?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top