Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Variable Load

by anshumangoyal (Scribe)
on Nov 15, 2012 at 12:28 UTC ( #1004003=perlquestion: print w/replies, xml ) Need Help??
anshumangoyal has asked for the wisdom of the Perl Monks concerning the following question:

I want to pump a variable traffic to an ethernet adaptor. For this i am using a utility which pumps the data. this utility takes -band <bandwidth> as input. I want to vary this bandwidth starting from 0 to reach 'x' and then come back to 0. For this can any one suggest a formula which gives me output in variance with this pattern?

Replies are listed 'Best First'.
Re: Variable Load
by thmsdrew (Scribe) on Nov 15, 2012 at 13:14 UTC

    If you're executing this command within Perl--which I assume you are, and already have that working--then two for loops would suffice.

    One of them counting up.

    for (1..$x) { system("data_pump data -band $_"); }

    The other counting down.

    for (reverse 1..$x) { system("data_pump data -band $_"); }

    Also, if the bandwidth isn't increasing by 1 each time, which my code assumes, use a $count variable and increment it each time in the for loop to get the desired bandwidth intervals.

Re: Variable Load
by karlgoethebier (Parson) on Nov 17, 2012 at 10:16 UTC

    Perhaps one less is more.

    perl -e 'for((1..10),reverse(1..10)){print}'

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1004003]
Approved by blue_cowdawg
[Your Mother]: I say I do. :P
[Your Mother]: Missiles would be an idiot’s play. Putin is many things but he is not an idiot.
[erix]: I like the idea of the trumps troup of imbeciles growing slightly nervous now their incompetence will be tested
[erix]: you seem forget there is another idiot coming :)
[Your Mother]: The US government does not attract talent, but grafters and liars and it has been that way for the better part of a century. FEW exceptions.
[erix]: you think it only /looks/ worse this time?
[Your Mother]: HR Clinton was literally threatening Russia. She would have been MUCH more likely to start real trouble.
[Your Mother]: I think there is less decorum this time.
[Your Mother]: We’ve had rapists and thieves and unqualified government. They just had decorum.
[erix]: heh, understatement of the week :)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-01-20 00:59 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (173 votes). Check out past polls.