Programming :: Read Time Of /proc/net/tcp6 File

Dec 8, 2010

I am trying to read the /proc/net/tcp6 file of a huge server (chat server) for monitoring the tcp6 connection states.

My server's tcp6 file has more than 26000 lines. For monitoring the server connections, my monitoring tool has to read the /proc/net/tcp6 file quickly in a regular interval (5 secs) and process. Presently it takes minimum 6-7 seconds for reading the whole file.

My tool can able to read the normal file (26,000 lines) less than 1 second, but it is not possible to read the same size of proc file.

I have 2 questions:

1) Why proc file takes more read time than normal file?

2) Is there any way to read the /proc/net/tcp6 file more quickly?

View 2 Replies


ADVERTISEMENT

Networking :: Delay In Reading The Huge Proc Net Tcp6 File?

Dec 7, 2010

I am trying to read the /proc/net/tcp6 file of a huge server (chat server) for monitoring the tcp6 connection states.

This tcp6 file has more than 26000 lines. For monitoring the server connections, my monitoring tool has to read the /proc/net/tcp6 file quickly in regular interval. Presently it takes minimum 6-7 seconds for reading the whole file.

My tool can able to read the normal file (26,000 lines) less than 1 second, but it is not possible to read the same size of proc file.

I have 2 questions:

1) Why proc file takes more read time than normal file?

2) Is there any way to read the /proc/net/tcp6 file more quickly?

View 1 Replies View Related

Programming :: Read In A File 1 Line At A Time?

Oct 22, 2010

i am trying to read in a file 1 line at a time and for some reason it stops printing out at about line 62,000.

i am doing this:
Code:
while(fgets(c0, 1085, fstream0) != NULL)

but after about 62,0000 lines it stops printing. no seg-fault, no core dump. it just stops printing to the terminal then returns me to the command line after a couple of minutes. as a hack i am doing split -l 50000 on the input and calling my program 5 times.is there some limitation on fgets that i am not understanding ?

View 8 Replies View Related

Programming :: C Library Or Some Functions To Read Proc Filesystem

Dec 6, 2010

I have a requirement, to read the complete proc filesystem from the linux pc.. Does linux provide some functions to read the proc filesystem means the directories and files present in the filesystem.. in short I want to create a treeview of proc filesystem. and if a user selects the file in the proc.. I should show the contents in the respective file. So I want some library or functions to read the proc filesystem..

View 1 Replies View Related

Programming :: Bash - Ps - Psgrep And Read /proc/$pid Make Script Exit

Mar 22, 2011

I have not been able to write bash to use a PID file to ensure no other instance of the same script is running! All three methods I can think of to see if the PID in the PID file is another instance of the script make the script exit with a return code of 1 but the same commands run at the command prompt work as expected.

The first attempt was:

Code:

The first attempted workaround was:

Code:

The second attempted workaround (with debug to make the following command prompt copy and paste meaningful) was:

Code:

Here's the command prompt session, testing with a stale PID file and then manually running the problem command and it behaving as expected:

Code:

This on Slackware64 13.1 which has bash 4.1.7.

In desperation I tried rebooting but the behaviour was the same.

View 2 Replies View Related

General :: How To Read File In Real Time

Jan 3, 2011

I have a log file that I would like to examine during some changes under process that writes to this log.
Is there some way to open this file and read in real time changes written to it ?

View 5 Replies View Related

Programming :: Serial Port Data Read Time Interval?

Oct 30, 2010

I am writing a C program which reads data over serial port. While reading data, if I send my data(which is a 13 byte structure) periodic with a period of 1 second for 10 times I read it without problem and I read the data 10 times as I sent and as I expectBut if I send data continuousuly(without any time interval between each sending) 10 times I can only read 1 of them(I can only read it once).

View 11 Replies View Related

Programming :: Set Period Of Time To Tcp Connection To Wait For Request Or Respond For Tcp Block Read

Feb 27, 2010

I wanted to know how can I set a period of time to a tcp connection to wait for request or respond for tcp block read. which system call or function I can use? Does any body know a very simple quick and easy reference on web for socket programing that has lots of socket programing examples in it?

View 1 Replies View Related

Ubuntu :: Get IO Time From /proc/diskstats?

Oct 28, 2010

I want to know how much time the computer is performing IO read/write during a time interval, so that i can compute the percentage of time spending on IO. I look at /proc/diskstats, and notice that there are these fields:

Field 1 -- # of reads issued
Field 2 -- # of reads merged, field 6 -- # of writes merged
Field 3 -- # of sectors read
Field 4 -- # of milliseconds spent reading

[Code].....

How can this happen? I thought the maximum value of the read and write time should not exceed the total time. Am I doing something wrong? Are there any other methods to get the disk IO time?

View 1 Replies View Related

Programming :: Splitting A File Based On The Values Read From An Input File?

Jul 27, 2010

I am splitting a file based on the values read from an input file. The below one is the script.

1)How do I add the header which is present in the original file to the new split files created?(For eg. pharmacyf conatins header as table column names. The new files created (ODS.POS.$pharmacyid.$tablename.$CURRENT_DATE.dat) are without the header).

2) Also the script is creating 0 byte files for the pharmacyids which are not available in the intial file? Can this be avoided?

for pharmacyf in *
do
tablename=`echo $pharmacyf |cut -f4 -d'.' `
while read pharmacyid
do
grep -w $pharmacyid $pharmacyf >> $OUT/ODS.POS.$pharmacyid.$tablename.$CURRENT_DATE.dat
done< inputfile
done

View 2 Replies View Related

Programming :: 3D Array In MAT File ->DAT File To Read In FORTRAN?

Jul 2, 2009

Alright, so I have been trying to resolve this issue for awhile, but now feel like help is very necessary.I have a 128(by)128(by)128 array in a MAT file, and am using the following MATLAB script to convert it to a DAT file:

load C_42.mat
fid=fopen('C_42.dat','wt')
fwrite(fid,Nu)

[code]...

View 2 Replies View Related

Programming :: Read Two Files Word By Word At A Time Using Any Loop By Shell Script?

Mar 4, 2010

Well, I am facing one issue:How can i read two files word by word at a time using any loop as i need word by word comparision in shell script?Please let me know pseudo code.

View 14 Replies View Related

Programming :: How To Read File Inside AWK?

Apr 13, 2011

I want to read content of a file inside a gawk script.I know that by using "gawk -f filename" I can read a file, but I want to do that inside the script.

View 7 Replies View Related

Programming :: Read A File With A While Loop?

Apr 25, 2010

ITT and am just lurning about scripting and need to read a file and output the file to the screen. We need to do this with a while loop.

View 5 Replies View Related

Programming :: Read The Contents Of A File?

Jan 11, 2010

I am trying to read the contents of a file into something else. I have a file.txt that I am working with, I want to read the file and take the data and run some commands with the data that it read. So if it read www.yahoo.com I want to be able to nslookup. Does that make sense? I have been trying to use the read command but that does not seem to work. I even was trying to read filename | > filename to see if I could even read any of the data at all. Nothing is working.

View 8 Replies View Related

Programming :: Read A Line From A Txt File In A Script?

Dec 9, 2010

have been playing around with a script for a few hours and now I need to be able to output the lines in a text file one by one to be used later in the script.What it gonna do is to read a log file and grep the usernames, then write them to a file, and then run one script for each user, to search for more information about them in the log.But I don't know how to output a single line from a file, and google does not return any solution.

View 3 Replies View Related

Programming :: Read From A File Named MatrixA?

Mar 10, 2011

I am trying to read from a file named matrixA.dat that contains a matrix formatted like this:

2 x 3
1 0 2 -1 3 1

I am reading the lines in, and this is the source that I have so far: Code: #include <stdio.h>
#include <string.h>
#define DATALIMIT 17
#define DIMLIMIT 5
#define NAMELIMIT 40

[Code]...

was stored in dataA, so when I print it all I get is a newline. Why didn't it grab the 1 0 2 -1 3 1 line?

View 3 Replies View Related

Programming :: BASH Read File Once Then Return To Top?

Aug 8, 2010

I have a script that reads part of a line, delimited between the first and second intended part by a colon. Then it "chops" the part after the colon, which are words offset by commas (counting them beforehand so as to catch every word in the string's second part), like this:

Code:

"COLORS.JPG:red,orange,yellow,green,"
(Returning)
red

[code]....

single script that parses/breaks both parts of a line like this "COLORS.JPG:red,orange,yellow,green;blue,indigo,violet," so that the two parts, separated into single words (or two and three words, sometimes with spaces) can be used as single-line annotations and written to JPEG files using Exiv2. So far, I haven't been able to come up with a script that does this without one part of the total string(usually that part after the colon) becoming the first word in the second array. In other words, I look for this:

KEYWORDS:

[ ]red
[ ]orange
[ ]yellow

[code]....

Or vice-versa (ie, the second array winds up as a single-line "member" of the first). I think it's because I'm using a single while read loop to read the text file in which the filenames and substrings happen to be. If there's some way of reading a file once and going back to the beginning to read it again in another while loop, I haven't found it.

View 14 Replies View Related

Programming :: Bash - Read File Without Whitespace?

Mar 14, 2011

I am struggling with Bash scripting at the moment (I can't seem how anyone can write scripts with this language!!!) I have a need at home to have a cron job execute daily to lookup my downloads.txt file, read each url (per line) and download content from that url. Then that entry needs to be removed (well I keep all urls in memory and clear the file afterwards). If an error occurred during the download process, then the url is written to a downloads.err file. I got all the above working except for properly reading the url from the text file without including newline characters. I am using the following to read:

while read url; do
--Do whatever here--
done < downloads.txt

How can I get it not to let the url variable have newline characters?

View 11 Replies View Related

Programming :: Read Text File Using Arrays In C++?

Oct 19, 2010

a project using bluetooth to send data byte by byte to external devices buti'm not familiar using arrays to read file from another location before sending the data.If you could,do correct my codes.Here's my code,

void loop(){
char Msg[]={"Hello"};
char *start;

[code]...

View 2 Replies View Related

Programming :: Read A Txt File With C++ In Linux And Output It?

Mar 15, 2010

i have wrote a long piece of code above with the "main" which is calling openFile( &fout, filename )filename contains the txt name in a form of "data.txt"i wanna read the data from the file and output it into fout for later use.the data in that file is a vector looking interger group.i have the following code:

int openFile( ofstream * fout, const char * filename)
{
ifstream iFile(filename);

[code]...

View 1 Replies View Related

Programming :: Read A Value From A File In Shell Script?

Mar 12, 2010

So my firefox's profile.ini file looks like this:less .mozilla/firefox/profiles.ini

Code:
[General]
StartWithLastProfile=1

[code]...

View 9 Replies View Related

Programming :: Read Each Line Of A File As Input?

Jun 21, 2011

I'm writing a program which now accepts user input:

Code:
echo "Enter a date in the format YYYY MM DD hh mm ss."

read gregyr gregmo gregdy greghr gregmn gregsc This lets the user input a date and time, such as 2011 06 21 15 12 45, and have each number assigned to their corresponding variable. Later in the program, these variables are put into an equation, and then the terminal spits out the answer. Now I have to have the program read all of the lines from a text file, which is in this format, assign the variables.

View 7 Replies View Related

Programming :: Read File Names In A Dir And Its Sub Dir In Perl?

Apr 22, 2010

I am writing a script that involves reading the content of a file present in a directory and/or its sub directory. I know readdir returns all the files & DIR names in a directory but how to check weather readdir is returning a file or a directory

View 2 Replies View Related

Programming :: Read The File Add Number And Get The Average?

Apr 29, 2010

I have a file which has several entries with

# comment 1
1245
# comment 2
5667
# comment 3
456456

how can I read the file, sum the numbers ( "avoid" the #lines) and then get the average of the numbers?

I do awk '{s+=$0} END {print s}' /tmp/file.txt. and this give me the sum correctly, but how can I get also the average ?

View 4 Replies View Related

Programming :: Read A File And Parse A String In C++

Jul 26, 2010

I need to read a file and parse a string. I know in Perl there is the split command. Is there something similar to that in C++?

View 6 Replies View Related

General :: Windows Access The File From Ubuntu Got Read Only Even Though Have A Full Permission To Read, Write And Execute The File?

Feb 4, 2010

What are the possible problem when Windows access the file from Ubuntu got Read Only even though have a full permission to read, write and execute the file? Ubuntu to Ubuntu accessing the file there is no problem only Windows got a problem.

View 1 Replies View Related

Fedora Installation :: An Error Occurred Mounting Device Proc As /proc: Mount Failed

Jul 6, 2010

I've got the F13 LiveCD that I was able to boot and use using the "nomodeset" boot option. From the desktop I'm trying to perform an Install to Hard Drive. I've read the Install from LiveCD post regarding the creation of a /boot partition and a / root partition. I've tried creating them without the LVM group and with. But every time I appempt to install I get...

An error occurred mounting device proc as /proc: mount failed: (9, None). This is a fatal error and the install cannot continue.

Hardware is a Sager 8887 (P4, 3.06HT, 60GB HDD, Radeon 9000 graphics adapter)

View 7 Replies View Related

Programming :: Script To Read A File And Get Each Column With Varibles?

Jul 2, 2010

i have a script to read a file and get each column with varibles.actually my file: hplog1 sample 3 lines consists of

client1_day- 2010
jan
client2 2009

[code]....

View 1 Replies View Related

Programming :: Read Multiple Lines From A Text File?

Mar 11, 2011

For example, I have a text file with data which lists numerical values from two separate individuals

Code:
Person A
100

[code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved