SaltyCrane Blog — Notes on JavaScript and web development

Some resources on task scheduling and CPU utilization

 

Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment: http://citeseer.ist.psu.edu/liu73scheduling.html

Aperiodic Task Scheduling for Real-Time Systems: http://citeseer.ist.psu.edu/sprunt90aperiodic.html

Issues in Real-time System Design:  http://www.eventhelix.com/RealtimeMantra/IssuesInRealtimeSystemDesign.htm

Rate-monotonic analysis keeps real-time systems on schedule: http://www.edn.com/article/CA81193.html

How to calculate CPU utilization: http://www.us.design-reuse.com/articles/article8289.html

 

 

How to measure execution time for a portion of VxWorks code using VxWorks 5.5 and Tornado 2

Use sysTimestamp() as documented in "VxWorks Device Driver Developer's Guide 6.2". This is the library used to measure time in WindView. If not already included, you need to include the system-defined timestamping in the VxWorks kernel. From the VxWorks tab of your bootable project in Tornado go to: "development tool components" -> "Windview components" -> "select timestamping" Right click on "system-defined timestamping" and choose "include 'system-defined timestamping'...", click "OK" Use sysTimestamp as shown in the example below:
void my_task()
{
    UINT32 timestamp1, timestamp2;
    double tsperiod, delta_time;

    sysTimestampEnable();
    tsperiod = (double)sysTimestampPeriod();

    timestamp1 = sysTimestamp();

    /* execute some code */

    timestamp2 = sysTimestamp();
    delta_time = (double)(timestamp2 - timestamp1)/tsperiod/sysClkRateGet();

    exit(0);    
}
Technorati tags:

QTableWidget Example using Python 2.4, QT 4.1.4, and PyQt

QTableWidget Example using Python 2.4, QT 4.1.4, and PyQt
import sys
from Qt import *

lista = ['aa', 'ab', 'ac']
listb = ['ba', 'bb', 'bc']
listc = ['ca', 'cb', 'cc']
mystruct = {'A':lista, 'B':listb, 'C':listc}

class MyTable(QTableWidget):
    def __init__(self, thestruct, *args):
        QTableWidget.__init__(self, *args)
        self.data = thestruct
        self.setmydata()
        
    def setmydata(self):
        n = 0
        for key in self.data:
            m = 0
            for item in self.data[key]:
                newitem = QTableWidgetItem(item)
                self.setItem(m, n, newitem)
                m += 1
            n += 1

def main(args):
    app = QApplication(args)
    table = MyTable(mystruct, 5, 3)
    table.show()
    sys.exit(app.exec_())
    
if __name__=="__main__":
    main(sys.argv)