Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

rk_ResourceSet.c

Go to the documentation of this file.
00001 /*
00002  * rk_ResourceSet.c
00003  *
00004  * Copyright (c) 2003, 2004 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file rk_ResourceSet.c
00014  *
00015  * Native implementation of the Java rk.ResourceSet class.
00016  */
00017 
00018 #include "config.h"
00019 
00020 #include <stdio.h>
00021 #include <string.h>
00022 #include <unistd.h>
00023 
00024 #include <sys/types.h>
00025 
00026 #include <rk/rk.h>
00027 
00028 #include "rk_util.h"
00029 
00030 #include "rk_ResourceSet.h"
00031 
00032 #define UNUSED_ARG(a) do {/* null */} while (&a == 0)
00033 
00034 JNIEXPORT jlong JNICALL
00035 Java_rk_ResourceSet_getUsage(JNIEnv *env, jclass java_class)
00036 {
00037     rk_resource_set_t rs;
00038     jlong retval = 0;
00039     
00040     UNUSED_ARG(env);
00041     UNUSED_ARG(java_class);
00042 
00043     if( (rs = rk_proc_get_rset(getpid())) != NULL_RESOURCE_SET )
00044     {
00045         struct rk_resource_set_usage rsu;
00046         int rc;
00047 
00048         memset(&rsu, 0, sizeof(rsu));
00049         if( (rc = rk_resource_set_get_usage(rs, &rsu, NULL)) == 0 )
00050         {
00051             retval = rsu.active_cpu_usage;
00052         }
00053         else
00054         {
00055         }
00056     }
00057     else
00058     {
00059     }
00060     return( retval );
00061 }

Generated on Fri Oct 22 07:50:24 2004 for CPU Broker by  doxygen 1.3.9.1