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

rk_ResourceSet.c

Go to the documentation of this file.
00001 /*
00002  * rk_ResourceSet.c
00003  *
00004  * Copyright (c) 2003 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         if( (rc = rk_resource_set_get_usage(rs, &rsu)) == 0 )
00049         {
00050             retval = rsu.cpu_usage;
00051         }
00052         else
00053         {
00054         }
00055     }
00056     else
00057     {
00058     }
00059     return( retval );
00060 }

Generated on Mon Dec 1 16:29:07 2003 for CPU Broker by doxygen 1.3.4