/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* ident "%Z%%M% %I% %E% SMI"
*
*/
/**
* A representation of the Locality Groups for a single Solaris
* instance.
*/
public class LocalityDomain
{
/**
* Obtain a Locality Group snapshot based on the view
* available to the caller.
*/
/**
* Obtain a Locality Group snapshot based on the view
* of the Operating System.
*/
static
{
}
/**
* The view used to create this LocalityDomain.
*/
private int view;
/**
* The cookie which represents the snapshot of locality
* information held by the lgrp library.
*/
private long cookie;
/**
* The root LocalityGroup for the LocalityDomain
*/
/**
* Cached value of maxLatency.
*/
private final int maxLatency;
/**
* String representation of often used property.
*/
/**
* Constructor.
*
* @param view to use when creating the LocalityDomain.
* @throws Exception if there is a problem initializing the
* lgrp snapshot.
*/
{
/*
* The maxLatency calculation is expensive and is used
* every time a locality objective is examined. Since
* it will never change over the lifetime of a
* LocalityDomain, we calculate it once in the
* constructor and cache for future use.
*/
maxLatency = calcMaxLatency();
}
/**
* Reclaim the resource allocated by the C proxy.
*
* @throws Throwable if there is a problem reclaiming the reosurces.
*/
{
try
{
close();
}
finally
{
super.finalize();
}
}
/**
* Return the "root" LocalityGroup.
*/
{
return (root);
}
/**
* Close this LocalityDomain. Resources are reclaimed in the C
* proxy and this LocalityDomain should never be used
* again. None of the LocalityGroups which are referenced from
* this LocalityDomain should be used after this method is
* invoked. NB: jl_fini returns a success indicator which is
* ignored as we are closing this domain.
*/
public void close()
{
if (cookie != 0) {
jl_fini();
cookie = 0;
}
}
/**
* Return a string representation of this instance.
*/
{
}
/**
* Return the groups in this domain to which the supplied cpus
* belong, excluding the supplied set of groups.
*
* @param exclude Set of groups to be excluded.
* @param cpus List of cpus
*
* @throws PoolsException if there is an error accessing the
* cpu details.
*/
{
}
return (result);
}
/**
* Return the locality group which contains the majority of
* the cpus in the supplied list. If more than one group
* satisfies this criteria, then the choice of group is
* deterministic but unspecified.
*
* @param cpus List of cpus to be examined.
*
* @throws PoolsException if there is an error accessing the
* cpu details.
*/
throws PoolsException
{
} else {
}
}
}
}
return (centre);
}
/**
* Return the maximum latency between the groups in this
* domain.
*
*/
private int calcMaxLatency()
{
int max = 0;
}
}
return (max);
}
/**
* Return the maximum possible latency between all locality
* groups in this domain.
*/
public int getMaxLatency()
{
return (maxLatency);
}
/**
* Return the set of all LocalityGroups for this LocalityDomain.
*/
{
return (groups);
}
/**
* Add all the descendent LocalityGroups for the supplied
* group into the supplied set.
*
* @param group is the group whose descendents are processed.
* @param descendents the set to add descendents of group.
*/
{
next();
}
}
}
/**
* Return the LocalityGroup containing the supplied CPU
* id. Search all LocalityGroups starting at the root group.
*
* @param cpuid is the sys-id of the CPU to search for.
*/
{
}
/**
* Return the LocalityGroup containing the supplied CPU
* id. Search LocalityGroups starting at the supplied group.
*
* @param group is the group to start searching from.
* @param cpuid is the sys-id of the CPU to search for.
*/
{
return (group);
}
} else {
next();
return (owner);
}
}
return (null);
}
/**
* Initialise the LocalityDomain with an lgrp snapshot.
*
* @param view is the type of snapshot to obtain.
*/
/**
* Release the lgrp snapshot.
*/
private native int jl_fini();
/**
* Find the root LocalityGroup.
*/
}