Sharon Clay (src++at++rose.engr.sgi.com)
Tue, 23 Sep 1997 01:42:04 -0700
Lots of great questions!
I'll take a quick stab at each.
src.
->
->Hi performers,
-> there are several question I'd like to have answered.
->1. By pfMultiprocess I initiated the FORK_DBASE process seperately, but
->there is no difference whether I use pfAddChild or pfBufferAddChild.
You use pfAddChild within the new scene graph in the DBase process.
To attach the new scene graph to the main tree, you have a bunch
of choices. You can pfBufferScope the parent node to the DBase process
or, you can pfBufferAddChild from the DBase process to a node
in the main tree with scope in the add process. You can also
keep a list of stuff to be hooked up and do it yourself in the
App process. pfBUfferAddChild is probably the most straight-forward
and convenient. Keeping the list yourself can give you
more tight control on how many nodes per frame you stick on the
main tree to keep you from over-burdening the APP.
->How can I give priorities to the different Performer processes ?
pfuLockDown{App,Cull,Draw,Proc} utilities in libpfutil and used
by perfly and pguide/libpf/C/procsetup.c are the way to go.
These utilities use the sysmp mechanism for restricting CPUs
to only run your real-time processes. Then, you can use
pfuPrioritizeProcs() which use the schedctl API to select
non-degrading priorities for those processes.
FYI, in Performer 2.2 we have a new pfuProcessManger that uses
new mechanimsms in IRIX and POSIX for a much more straightforward
and powerful real-time management system.
Also, in general, you should know about the 'realtime' man page that
talks about IRIX real-time extensions.
->2. Is it possible to install a routine which is strongly periodically
->called by a clock dependent thing ?
You can certainly do this with signals. In general, I recommend
against such a heavy handed technique - schedule ahead instead
of respond after. What do you really want to do here?
->3. Why doesn't work the PFUDEV_WINQUIT event and why can't a pfPipeWindow
->closed by Alt-F4 or doubleclicking the upper left corner ?
Really good question. This is an X thing. You can turn it on with
pfPWinMode(Shared->pw, PFWIN_EXIT, 1);
We will then regester the proper X atoms on the window.
Then, you need to recognize the X atoms and process the resulting
X event.
In init of X handlign process:
wm_protocols = XInternAtom(dsp, "WM_PROTOCOLS", 1);
wm_delete_window = XInternAtom(dsp, "WM_DELETE_WINDOW", 1);
In X process event loop:
case ClientMessage:
if ((event.xclient.message_type == wm_protocols) &&
(event.xclient.data.l[0] == wm_delete_window))
{
pfNotify(PFNFY_NOTICE,PFNFY_PRINT,"Window exit !!");
pfExit();
}
break;
->4. Can I a pfiTDFXformer slow down to speed zero in a certain time ?
Well, with pfiIXformStartMotion() you can set a speed and
acceleration (that can also be a decelartaion). Is this along
the lines of what you want?
->5. I would like to know the size of my pfNodes in memory. Is it possible
->to calculate that anyhow ?
Well, you can always do a pfGetSize() on any pfMemory. Additionally,
amallinfo can tell you the size of a malloc block and can tell
you how much room is used up inside an arena.
The following memsize program does all of this:
/*
* memsize.c:
*
* $Revision: 1.3 $ $Date: 1997/04/10 20:32:15 $
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <malloc.h>
#include <Performer/pf.h>
#include <Performer/pfs.h>
#define PRINT_STRUCT_SIZE(_struct) { \
pfNotify(PFNFY_NOTICE, PFNFY_MORE, "pf%s size: %d bytes", \
#_struct, sizeof(pf##_struct)); \
}
#define PRINT_PRSIZE(_new) { \
void *_mem = pfNew##_new((void*)NULL); \
int _ms = mallocblksize(_mem); \
pfNotify(PFNFY_NOTICE, PFNFY_MORE, "%s size: %d bytes pf: %d", \
#_new, _ms, pfGetSize(_mem)); \
}
#define PRINT_PFSIZE(_new) { \
void *_mem = pfNew##_new(); \
int _ms = amallocblksize(_mem, pfGetSharedArena()); \
pfNotify(PFNFY_NOTICE, PFNFY_MORE, "%s size: %d bytes, pf: %d", \
#_new, _ms, pfGetSize(_mem)); \
}
void printMallInfo(struct mallinfo *mall)
{
pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "Heap - total bytes used: %d",
mall->usmblks + mall->uordblks);
}
void printAMallInfo(struct mallinfo *mall)
{
pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "Arena - total bytes used: %d",
mall->usmblks + mall->uordblks);
}
int main (void)
{
struct mallinfo mall;
pfInit();
/* Initialize Performer */
pfInitState(NULL);
mall = mallinfo();
printMallInfo(&mall);
pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "Libpr Objects:");
PRINT_PRSIZE(GSet);
PRINT_PRSIZE(GState);
PRINT_PRSIZE(Tex);
PRINT_PRSIZE(TLoad);
PRINT_PRSIZE(ImageCache);
PRINT_PRSIZE(TEnv);
PRINT_PRSIZE(Mtl);
PRINT_PRSIZE(Light);
PRINT_PRSIZE(LModel);
PRINT_PRSIZE(Fog);
PRINT_PRSIZE(Terrain);
{
char *_mem = (char*) pfNewList(4, 1, 0);
int _ms = mallocblksize(_mem);
pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "pfList size: %d bytes",_ms);
}
mall = mallinfo();
printMallInfo(&mall);
pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "pfConfig:");
pfConfig();
mall = amallinfo(pfGetSharedArena());
printAMallInfo(&mall);
pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "Libpf Objects:");
PRINT_PFSIZE(Geode);
PRINT_PFSIZE(DCS);
PRINT_PFSIZE(Group);
PRINT_PFSIZE(LOD);
PRINT_PFSIZE(ASD);
mall = mallinfo();
printMallInfo(&mall);
mall = amallinfo(pfGetSharedArena());
printAMallInfo(&mall);
}
--
-----{-----{---++at++ -----{----{---++at++ -----{----{---++at++ -----{----{---++at++
Sharon Rose Clay (Fischler) - Silicon Graphics, Advanced Systems Dev.
src++at++sgi.com (415) 933 - 1002 FAX: (415) 965 - 2658 MS 8U-590
-----{-----{---++at++ -----{----{---++at++ -----{----{---++at++ -----{----{---++at++
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:58 PDT