Example #1
0
/* Get Idle Time */
unsigned int rkusb_calc_laod( unsigned long data )
{
                unsigned int idle_ticks, total_ticks;
                unsigned int load = 0;
	//cputime64_t cur_jiffies;
	unsigned int j;
	int     next = (int)data;
	idle_ticks = UINT_MAX;
	{
		cputime64_t total_idle_ticks;
		cputime64_t total_total_ticks;
		unsigned int tmp_idle_ticks;
		j = 0;
		total_total_ticks = jiffies64_to_cputime64(get_jiffies_64());
	                total_ticks = (unsigned int) cputime64_sub(total_total_ticks,last_total_ticks);
	                last_total_ticks = get_jiffies_64();
	                
		total_idle_ticks = rkusb_get_cpu_idle_time(j);
		tmp_idle_ticks = (unsigned int) cputime64_sub(total_idle_ticks,last_idle_ticks);
		last_idle_ticks = total_idle_ticks;
		if (tmp_idle_ticks < idle_ticks)
			idle_ticks = tmp_idle_ticks;
	}
	if (likely(total_ticks > idle_ticks))
		load = (100 * (total_ticks - idle_ticks)) / total_ticks;
                mod_timer( &cal_load_timer , jiffies + (next*HZ));
                S_ERR("%s:load=%d,tick=%d\n" , __func__ , load , next); 
                return load;
}
Example #2
0
RpcStringBinding::RpcStringBinding
    (
    DUALSTRINGARRAY*    pdsa,
    int			portNumber
    )
  : m_ipAddress (0),
    m_portNumber (portNumber),
    m_protocolSeq (0),
    m_strFormat (0),
    m_strFormatNoPortNumber (0)
    {
    // Check the DUALSTRINGARRAY entries, to find one which can be
    // 'resolved' into an IP address on this machine. Win2K sometimes
    // provides hostnames as well as the IP numbers that NT usually
    // sends, so we need to scan the array to find an IP number...
    OLECHAR* pStart = pdsa->aStringArray;
    OLECHAR* pCurr = pStart;
    
    while ((pCurr - pStart) < pdsa->wNumEntries)
        {
        // Make a string-binding out of the DSA entry...
	char * pStr = new char [comWideStrLen (pCurr + 1) + 1];
	comWideToAscii (pStr, pCurr + 1, comWideStrLen (pCurr + 1) + 1);
        initialiseFromString (pStr);
	delete []pStr;
        m_protocolSeq  = *pCurr;

        // See if it can be 'resolved' into a viable IP number...
        if (! resolve ())
            {
            S_ERR (LOG_DCOM, "Could not resolve " << ipAddress ());

            // Free up the allocated strings.
            delString (m_ipAddress);
            delString (m_strFormat);
            delString (m_strFormatNoPortNumber);

            // Could not make sense of the address, so move on through
            // the array to the next entry, or the end of the array...
            while (((pCurr - pStart) < pdsa->wNumEntries) && (*pCurr))
                ++pCurr;

            ++pCurr;
            }
        else
            {
            S_INFO (LOG_DCOM, "Resolved " << ipAddress ());

            // Take the first one that is viable...
            break;
            }
        }
    // at this point the string binding may have worked or not so the calling
    // routine must make a call to resolve to determine if a valid address was
    // bound since the constructor can't /init
    }
Example #3
0
ULONG VxStdProxy::Release ()
    {
    DWORD n = comSafeDec (&m_dwRefCount);

    // Is ref-count exhausted?
    if (n == 0)
	{
	// Object is about to be destroyed, we need to release
	// all refs we have on the remote object itself. We must
	// release all refs on a per-IPID basis...
	REMINTERFACEREF* pRef=0;
	int nRefs=0;

	{
	VxCritSec cs (m_mutex);

	nRefs = m_facelets.size ();
	pRef = new REMINTERFACEREF [nRefs];

	FACELETMAP::const_iterator i = m_facelets.begin ();
	for (int n=0; n < nRefs; ++n)
	    {
	    facelet_t* pFacelet = (facelet_t*) &((*i).second);
	    pRef [n].ipid = pFacelet->ipid;
	    pRef [n].cPublicRefs = pFacelet->remoteRefCount;
	    pRef [n].cPrivateRefs = 0;
	    ++i;
	    }
	}

	// Make remote call, if there are any remote refs to release
	if (nRefs)
	    {
	    HRESULT hr = m_pRemUnknown->RemRelease (nRefs, pRef);
	    if (FAILED (hr))
		S_ERR (LOG_DCOM, "RemRelease failed " << hr);
	    }

	// Tidy up and destroy this object...
	delete this;
	delete []pRef;
	}
    return n;
    }