Is there any way the program can be modified to see kb per minuit instead of second?
Or possible a script to take the -t output and average a process?
Logged In: YES user_id=1266587
Something like
ratio = (ratio * (ts - 1) + recv_kbps) / ts;
every time it calls do_refresh() or something. That way it would keep the current average bandwidth ussage.
I'd do it myself but it's been forever sense I've done C++.
Haha. I got it to work. I only wanted to track one object...
In cui.cpp,
void Line::show (int row) { if (DEBUG || tracemode) { assert (m_uid >= 0); assert (m_pid >= 0); char tema; //char temb; double ts; double ratio; double kbs;
if (*m_name == 'b') {
ifstream filea ("ratio", ios::in); ifstream fileb ("ts", ios::in);
while(! filea.eof() ) { filea >> ratio; } //ratio = tema; filea.close();
while(! fileb.eof() ) { fileb >> ts; } //ts = tema; fileb.close(); //kbs = recv_kbps; kbs = sent_kbps;
std::cout << ts << "\t" << kbs << "\t" << ratio;
//ratio = (ratio * (ts - 1) + recv_kbps) / ts; ratio = (ratio * (ts - 1) + sent_kbps) / ts;
std::cout << "\t" << ratio << "\n";
ofstream fila ("ratio", ios::out); ofstream filb ("ts", ios::out);
//fileb.open ("ts", los::trunc); ts++;
fila << ratio; filb << ts;
}
Replace the comments to change from in and out. Probably the dumbest way to acheive it.
Logged In: YES
user_id=1266587
Something like
ratio = (ratio * (ts - 1) + recv_kbps) / ts;
every time it calls do_refresh() or something. That way it
would keep the current average bandwidth ussage.
I'd do it myself but it's been forever sense I've done C++.
Logged In: YES
user_id=1266587
Haha. I got it to work. I only wanted to track one object...
In cui.cpp,
void Line::show (int row)
{
if (DEBUG || tracemode)
{
assert (m_uid >= 0);
assert (m_pid >= 0);
char tema;
//char temb;
double ts;
double ratio;
double kbs;
if (*m_name == 'b')
{
ifstream filea ("ratio", ios::in);
ifstream fileb ("ts", ios::in);
while(! filea.eof() )
{
filea >> ratio;
}
//ratio = tema;
filea.close();
while(! fileb.eof() )
{
fileb >> ts;
}
//ts = tema;
fileb.close();
//kbs = recv_kbps;
kbs = sent_kbps;
std::cout << ts << "\t" << kbs << "\t" << ratio;
//ratio = (ratio * (ts - 1) + recv_kbps) / ts;
ratio = (ratio * (ts - 1) + sent_kbps) / ts;
std::cout << "\t" << ratio << "\n";
ofstream fila ("ratio", ios::out);
ofstream filb ("ts", ios::out);
//fileb.open ("ts", los::trunc);
ts++;
fila << ratio;
filb << ts;
}
Replace the comments to change from in and out. Probably
the dumbest way to acheive it.