Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Files used by a process 1

Status
Not open for further replies.

icecubegr

Programmer
Jul 27, 2006
26
This is the first time I write here, so "Hi everybody" and thanks in advance for your answers (I hope I get some hahaha)

I have a performance issue on a program based on hashed files and I am pretty sure that the reason is that some files are badly resized (very important for hash files). The problem is that this program is like a black box with around 4000 files and I do not know the file accessed at a moment by a specific process.

Is there any way to get that from the system?

If I cannot do it from system level I guess I have to write a program. Note that all files are placed in many directories placed to a parent directory (its like a tree), so maybe I can scan recursuvely the main directory and check access time for each one of the files placed in them.

Thanks again and sorry for my pure english :)))))
George
 
thankx @mbourne

today here is no working day, so when I will go to the system I will try it
 
Thanks mbourne2006

I tried this command on so many process but i couldn't get the files opened by them! I don't know, i might be doing something wrong. Any idea?

Code:
# svmon -P 221360 -f -j

-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd  16MB
  221360 inetd                0        0        0        0      N     N     N

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual

# svmon -P 438486 -f -j

-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd  16MB
  438486 tnslsnr              0        0        0        0      Y     N     N

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual

# svmon -P 540784 -f -j

-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd  16MB
  540784 xterm                0        0        0        0      N     N     N

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual

# svmon -P 458778 -f -j

-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd  16MB
  458778 ksh                  0        0        0        0      N     N     N

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual

# svmon -P 315554 -f -j

-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd  16MB
  315554 rpc.mountd           0        0        0        0      N     Y     N

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual

Regards,
Khalid
 
I run svmon and it seems to work fine for me. See a part of output:
*-----------------------------------------------------
# svmon -U orcltst -f -j

===============================================================================
User Inuse Pin Pgsp Virtual LPageCap
orcltst 324 0 0 0 -

...............................................................................
EXCLUSIVE segments Inuse Pin Pgsp Virtual
98 0 0 0

Vsid Esid Type Description LPage Inuse Pin Pgsp Virtual
ca55d - pers /dev/ramdisk0:62 - 98 0 - -
/jbasetmp/tmp_54

...............................................................................
SHARED segments Inuse Pin Pgsp Virtual
226 0 0 0

Vsid Esid Type Description LPage Inuse Pin Pgsp Virtual
800f0 1 pers code,/dev/hd2:6424 - 57 0 - -
/usr/bin/ksh
b06f4 1 pers code,/dev/hd2:4860 - 38 0 - -
*-----------------------------------------------------

As I said all data files are in a directory so with grep I can get only the files that i am interested e.g.
svmon -U orcltst -f -j | grep /datadir

There is only one problem with that command. Usually when I want to run, I will not be root. Big problem eeeee???? hahahaha
 
Also I checked lsof in linux and I can get real filenames. See the output:
*-----------------------------------------
[root@localhost root]# lsof -u uv2jb
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sh 2223 uv2jb cwd DIR 8,33 1024 2 /home/uv2jb
sh 2223 uv2jb rtd DIR 8,1 4096 2 /
sh 2223 uv2jb txt REG 8,1 626028 413018 /bin/bash
sh 2223 uv2jb mem REG 8,1 103044 127126 /lib/ld-2.3.2.so
sh 2223 uv2jb mem REG 8,1 30301680 127060 /usr/lib/locale/locale-arc
hive
sh 2223 uv2jb mem REG 8,1 21040 413005 /usr/lib/gconv/gconv-modul
es.cache
sh 2223 uv2jb mem REG 8,1 5524 412949 /usr/lib/gconv/ISO8859-1.s
o
sh 2223 uv2jb mem REG 8,1 11784 127266 /lib/libtermcap.so.2.0.8
sh 2223 uv2jb mem REG 8,1 15084 127137 /lib/libdl-2.3.2.so
sh 2223 uv2jb mem REG 8,1 52472 127147 /lib/libnss_files-2.3.2.so
sh 2223 uv2jb mem REG 8,1 1531064 47761 /lib/tls/libc-2.3.2.so
sh 2223 uv2jb 0u CHR 136,0 2 /dev/pts/0
sh 2223 uv2jb 1u CHR 136,0 2 /dev/pts/0
sh 2223 uv2jb 2u CHR 136,0 2 /dev/pts/0
sh 2223 uv2jb 255u CHR 136,0 2 /dev/pts/0
*--------------------------------------------------

I do not know why in AIX version instead of file names, I get file system names!!!!!
 
New update about svmon
It does not list the files I am interested of. Before I saw many filenames and I thought it was working as I wanted, so I did not test it with those files. I thought like "why not working with the files i am interested"

To give you more info, I work with jbase and each table is a binary (hash) file in the system. So I just test it with me try to edit data in a table. I expected at least the file of that table to be listed as an open file, but... NO

I REALLY CANNOT UNDERSTAND HOW THIS CAN HAPPEN
-----------------------------------------------
I think I am going to make a simple C program to scan the directory I am interested recursively and check each file
 
The solution to my problem is AIX command 'procfiles'. See an example:
*-------------------------------------------------
$ procfiles -n 131162 | grep /jbdata
-n option failed, as temporary file cannot be created
O_RDWR size:16384 name:/jbdata/eb/F.SPF
O_RDWR size:57344 name:/jbdata/pd/FBNK.PD.A004
O_RDWR size:16384 name:/jbdata/eb/F.TEC.PRO000
O_RDWR size:90112 name:/jbdata/eb/F.STATIC.000
O_RDWR size:827392 name:/jbdata/eb/F.ACTIVITY
O_RDWR size:843776 name:/jbdata/eb/F.LOCKING
O_RDWR size:11243520 name:/jbdata/eb/F.PROTOCOL
O_RDWR size:4104192 name:/jbdata/eb/F.DYNAMIC001
O_RDWR size:712704 name:/jbdata/eb/F.PGM.FILE
O_RDWR size:151552 name:/jbdata/eb/F.TYPE.PROG
O_RDWR size:16384 name:/jbdata/eb/F.USER.AB000
O_RDWR size:28672 name:/jbdata/eb/F.ABBREVI001
O_RDWR size:622592 name:/jbdata/eb/F.FILE.CO001
O_RDWR size:16384 name:/jbdata/eb/F.TEC.OUT000
O_RDWR size:16384 name:/jbdata/eb/F.TEC.ACT000
O_RDWR size:49152 name:/jbdata/pd/FBNK.PD.O002
*-----------------------------------------------
Note that the message about '-n' flag I did not get when i run as root, but as i said i like to run as normal user. Anyway I am receiving the filenames i want even without that flag, so no problem

here is a link about '/proc file system'
 
Nice :)

Thanks icecubegr for the nice post. I think you deserve a star for that

Regards,
Khalid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top