Hi,<br /><br />I'm a Computer Science student and I'm currently studying databases buffer managers. I want to do some
experimentsand see how the pages access works in PostgreSQL. (and I also will do some I/O experiments)<br /><br />So, I
wantto do a "sniffer" on the Storage Layer of Postgresql. It should work telling me the page that PGSQL is reading or
writing.So when I make some operation on PGSQL, the pages that were requested (to read or write) by PGSQL for the
buffer,are stored in a separated file. And after that i can build some graphs, conclusions, etc...<br /><br />So, I
madesuch a code to do that, but i'm not quite sure if I'm doing the right thing. Can someone of you give me a opinion
??<br/><br />Many Thanks in advance,<br />Jonas Jeske<br /><br />The modified code is in bufmgr.c of PostgreSQL source
code.<br/><br />Buffer<br />ReadBuffer(Relation reln, BlockNumber blockNum)<br />{<br /> volatile BufferDesc
*bufHdr;<br/> Block bufBlock;<br /> bool found;<br /> bool isExtend;<br /> bool
isLocalBuf;<br/><br /> /*jjeske starts here */<br /> FILE *fp;<br /> fp =
fopen("/home/jjeske/tpccuva/pgsql/saida.txt","a"); <br /> fprintf(fp,"Read Block n: %d\n",(int) blockNum);<br
/> fclose(fp);<br /><br />....<br /><br />static void<br />write_buffer(Buffer buffer, bool unpin)<br />{<br />
volatileBufferDesc *bufHdr;<br /><br /> /*jjeske starts here */<br /> FILE *fp;<br /> fp =
fopen("/home/jjeske/tpccuva/pgsql/saida.txt","a"); <br /> fprintf(fp,"Write Block n: %d\n",(int) buffer);<br
/> fclose(fp);<br />....<br /><br />