« AnteriorContinuar »
METHOD AND APPARATUS FOR
TRACKING PROGRAM EXECUTION TIME
IN A COMPUTER SYSTEM
BACKGROUND OF THE INVENTION 5
The present invention relates generally to the field of computer system resource management, and in particular to a method and apparatus for tracking program execution time.
In an effort to capitalize on the rapidly-expanding market 10 for on-line computer services, local cable television operators have begun investigating ways of providing on-line computer services to subscribers over existing cable networks. An attractive selling feature for such services is dramatically-improved access speed enabled by hybrid fiber 15 coax cable networks, as compared to the often frustratinglyslow access speeds available with the more common POTS (Plain Old Telephone System) access methods.
A key challenge faced by cable operators, both from a 2Q technical and a business standpoint, is how to bill subscribers for the on-line services they receive. One possible approach is to use the same method currently employed by most cable operators for television services; namely, a flat monthly rate for unlimited usage. This approach is rather ^ inflexible, however, tending to punish low-volume users while conferring a windfall of sorts on high-volume users. Moreover, while subscribers for television services are accustomed to such flat-fee billing practices, many current users of on-line services are accustomed to billing practices 3Q more closely tailored to their actual usage. Most on-line service providers can bill customers at an hourly rate based on actual usage. It is therefore desirable for cable operators to be able to offer this same type of flexible billing.
Another challenge faced not only by cable operators, but 35 more generally by any entity providing on-line services, is how to tailor information or services to the particular desires of individual clients. One way in which this is done is by maintaining individualized "profiles" for subscribers. A user profile can be a highly-effective marketing tool, enabling a 40 service provider to offer specialized services or content to subscribers based on their individual interests and preferences. Such profiles have commonly been created with the aid of a user survey. A less intrusive, and therefore more desirable, method of compiling a user profile would be to 45 gather information about the applications actually used by a subscriber.
One way in which a cable operator may provide on-line services to subscribers involves an arrangement in which the cable operator maintains a central server computer acces- 50 sible by large numbers of subscriber (client) computers over standard cable connections. The cable operator's server may itself provide on-line services to subscribers, such as Internet access, or it may function as a proxy through which subscribers can access other on-line service providers (OSPs), 55 such as AmericaOnlineTM and ProdigyTM. Combinations of these methods are also possible.
To facilitate a client-server arrangement of this type, a cable operator may furnish software for installation on a client computer providing an interface for accessing on-line 60 services from or through the cable operator's server. Such client software would typically permit a subscriber to browse and launch cable-specific applications (that is, applications provided directly or indirectly by the cable operator's server). As noted above, it may be desirable for both 65 billing and marketing purposes for the client software to track the subscriber's usage of cable-specific applications
and periodically report such information back to the server. Unfortunately, tracking application program usage is not necessarily a straight-forward process, particularly in a WindowsTM 3.n/95 or similar multitasking operating environment.
Multitasking (the ability to concurrently run multiple applications) is a characteristic feature of any WindowsTM or WindowsTM-like operating system. Such operating systems generally maintain a system task list identifying all currently-running applications. Relatively little information is kept in the system task list, however, usually being limited to a handle for locating the application and perhaps a title. System task lists of this type notably fail to provide detailed information concerning relationships between or among active applications. For example, a so-called "parent" application may spawn several "child" tasks, all of which would appear separately in the system task list. Moreover, a parent application may spawn a child task and then immediately terminate, in which case only the child task appears in the system task list, likely with attributes that are entirely different from those of the parent task.
Tracking the relationships between parent and child tasks can be highly useful, especially in the context of the abovedescribed client-server application. For example, a cable operator may choose to bill a subscriber only in terms of a parent application, but have the usage total for the parent application reflect any usage of applications spawned by that parent application. Unfortunately, due to the various permutations in the way programs may be implemented in a multitasking environment, as well as the limited information about task relationships typically available from such systems, it becomes a difficult and complicated undertaking to accurately track program usage with currently-available technology.
SUMMARY OF THE INVENTION
An embodiment of the present invention provides a method for monitoring application program execution time in a computer system having an operating system which controls execution of one or more application programs, with each application program including an executable task and one or more executable subtasks. The method includes detecting initiation of a first-executed task associated with an application program, determining a current system time corresponding to that initiation, and setting a starting time for the application program to the current system time. The method also includes detecting termination of a lastexecuted task or subtask associated with the application program, determining a current system time corresponding to that termination, and setting a final ending time for the application to the current system time.
Such embodiments may be particularly useful when applied in a client-server arrangement in which a server computer receives information relating to a client computer's use of application software for the purpose of billing the client user based on the extent of such usage. An example of such a client-server arrangement is where a cable operator provides application program services to subscribers under a usage-based billing arrangement.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a schematic diagram illustrating the architecture for an embodiment of the present invention.
FIG. 2 is a flow diagram illustrating the processing logic for an embodiment of the present invention.
The present invention provides a method and apparatus for tracking program usage in a computer system. FIG. 1
illustrates schematically the system architecture for an embodiment of the present invention. In this embodiment, a client computer 1 is coupled to a server computer 8 by a communications link 9. Client computer 1 includes a graphical user interface 3 which enables a user of client computer 5 1 to launch a variety of displayed application programs. Launched application programs run under the control of an operating system 2 installed on client computer 1. Graphical user interface 3 may launch zero or more tasks 6, corresponding to displayed application programs, and each task 6 may in turn launch zero or more subtasks 7.
Graphical user interface 3 includes a program monitor 4 configured to track program usage information for applications launched by graphical user interface 3. To this end, program monitor 4 maintains a local record file 5 with current status information relating to task,s 6 and subtasks 7 15 running under operating system 2. Program monitor 4 may also update a remote database 10 resident on server computer 8 with program usage information, preferably identifying such information in a manner which uniquely associates it with client computer 1 to enable server computer 8 to 20 separately maintain program usage information for a plurality of clients. Server computer 8 preferably includes a remote timer 11 which program monitor 4 may use as a trusted time source.
Client computer 1 may be, for example, a standard 25 desktop or notebook personal computer. Alternatively, client computer 1 may be a specially-configured television including user interface software. Server computer 8 is preferably a dedicated personal computer configured as a network server, but may alternatively be a minicomputer or main- 30 frame computer providing similar functionality. Communications link 9 may be any suitable means for enabling two computers to communicate with one another, including a hybrid fiber coax network, a fiberoptic cable, a POTS connection, or even a wireless connection. Depending upon 35 the particular characteristics of communications link 9, client computer 1 may include specialized software and/or hardware, such as a modem, to enable digital or analog communications between client computer 1 and network computer 8 across communications link 9. This embodiment 40 is not dependent upon any particular type of communications link 9.
Operating system 2 is preferably a WindowsTM 3.n/95 operating system, although embodiments of the present invention may be advantageously applied in other operating 45 environments as well. Operating system 2 is capable of managing a plurality of concurrently running tasks 6, each of which in turn may spawn one or more subtasks 7. For example, a program driving the "main window" of an on-line service would represent a task, while an Internet 50 browser program available from the main window would represent a subtask. A task with one or more subtasks is referred to as a "parent," with the respective subtasks referred to as "children." Operating system 2 permits a user to toggle among active tasks 6 and subtasks 7, and prefer- 55 ably maintains a system task list identifying tasks 6 and subtasks 7 currently running under operating system 2.
Where operating system 2 is a WindowsTM system, program monitor 4 is preferably implemented as a dynamic link library (DLL). In the present embodiment, program monitor 60 4 is implemented as a sub-module of graphical user interface 3, and is principally concerned with tracking tasks 6 and subtasks 7 launched either directly or indirectly by graphical user interface 3. Alternatively, program monitor 4 may be implemented more in the nature of a stand-alone utility 65 which tracks all tasks 6, and subtasks 7 running under operating system 2 regardless of their origin.
Program monitor 4 may be distributed as pre-loaded software (comprising a set of executable instructions) resident in a memory of a personal computer, such as the hard-disk of a notebook computer. Alternatively, the software may be distributed to users in the form of a userinstallable program stored on any of a variety of portable media, including diskette and CD. Yet another possibility is that the software could be made available on a network server for downloading upon request by a user.
Program monitor 4 maintains usage information relating to tasks 6 and subtasks 7 in local record file 5. Local record file 5 may be implemented in a WindowsTM environment as a WindowsTM initialization file (.INI extension); however, local record file 5 may be any data store resident on client computer 1 to which program monitor 4 has read/write access. Local record file 5 preferably resides on a "permanent" storage medium, such as a hard disk of client computer 6, so that information in local record file 5 is retained between usage sessions. Local record file 5 may store a variety of information concerning tasks 6 and subtasks 7 running under operating system 2, such as a LaunchID for each task 6 launched by graphical user interface 3 and a total number of active tasks 6 and subtasks 7. The particular information maintained may vary with the requirements of any given implementation.
Remote database 10 is preferably an SQL (Structured Query Language) database, although this embodiment is not dependent upon the use of any particular type of database. Program monitor 4 is capable of reading data from and writing data to remote database 10 over communications link 9 using, for example, standard SQL calls. Remote timer 11 may be, for example, a software-implemented function configured to return a reliable system time upon request by a calling routine. Program monitor 4 is capable of reading a system time from remote timer 11.
Where operating system 2 is a WindowsTM 3.n/95 system, program monitor 4 may be implemented as a WindowsTM callback function which is called by the WindowsTM dynamic link library "TOOLHELP.DLL" whenever a task starts or ends. In such an embodiment, program monitor 4 may be configured to process all WindowsTM messages generated by starting or terminating tasks, thereby enabling it to track information relating to program usage. As is known in the art, the message-handling code within program monitor 4 preferably uses a non-blocking mechanism due to the sensitive nature of the WindowsTM multitasking environment.
Turning now to functional features of the present invention, FIG. 2 describes a method for tracking program usage according to an embodiment of the present invention. For illustration purposes, structural features are identified using the same reference numbers used in FIG. 1; however, the method of FIG. 2 is not limited to that structural embodiment. In this latter embodiment, the total execution time for a launched application is defined as the time period between (a) the start time of the first task spawned by the application, and (b) the end time for the last active task or subtask spawned by the application.
Referring now to FIG. 2, processing begins when program monitor 4 receives a callback message from operating system 2. Program monitor 4 inspects the callback message to determine whether a task is being started or is ending. In a WindowsTM environment, the callback message will include a unique identifier, or handle, for the task. If a task is being started, program monitor 4 further determines whether the task is the first task of an application launched
by graphical user interface 3 (Step 120). If so, program monitor 4 calls server computer 8 with a request for the current system time from remote timer 11. Program monitor 4 then creates a new application record in local record file 5 (Step 121). The new application record preferably includes 5 a unique LaunchID for the application, assigned by program monitor 4, a StartDateTime based on the retrieved current system time, and a projected EndDateTime for use in the event graphical user interface 3 terminates prematurely, for example, due to a power outage. The projected EndDateTime may initially be set to some predetermined time period after the StartDateTime, such as twenty seconds.
Since, in this example, the current task is the first task spawned by the launched application, program monitor 4 also adds a task record to local record file 5. The task record preferably includes a unique TaskID, such as the WindowsTM-assigned task handle, as well as the LaunchID to associate the task with the newly-launched application. Task records in local record file 5 also preferably include a parent/child flag indicating whether the task being started is the first task spawned by an application (the parent) or a sub task (a child).
Program monitor 4 may use certain WindowsTM API functions to retrieve information about active tasks. For example, the GetCurrentTask( ) function may be used to 2J retrieve the handle for a currently-running task 6 or subtask 7. The TaskFindHandle( ) function may then be used to retrieve additional information about the task 6/subtask 7 associated with the retrieved handle. TaskFindHandle( ) fills a data structure called TASKENTRY. TASKENTRY 3Q includes an InTaskParent variable that identifies whether the task 6/subtask 7 is a parent or a child.
Task records may be implemented as an array of TasklDs contained within an application record. In another arrangement, task records may be separate physical records 35 associated with an application record in a hierarchical data structure. The parent/child designation enables program monitor 4 to continue tracking program usage information for a given application for as long as tasks spawned directly (parent) or indirectly (children) by that application are 40 running, even where a parent task has terminated. Program monitor 4 is also capable of tracking program usage for multiple instances of a given program, since the operating system views each such instance as a distinct task.
Once the new application record is built in local record 45 file 5, program monitor 4 reports the LaunchID and EndDateTime, along with a ClientID, to server computer 8 for storage in remote database 10 (Step 122). The ClientID, assigned by program monitor 4, uniquely associates the program usage information with client computer 1, and may 50 comprise the TCP/IP address for client computer 1. This association may be made even more specific by appending a UsernD to the TCP/IP address, thereby enabling server computer 8 to individually track program usage for multiple users of client computer 1. 55
Maintaining program usage information both in client computer 1 and server computer 8 is advantageous for a variety of reasons. For example, such redundant record keeping helps prevent abuse by a user of client computer 1, such as altering the contents of local record file 5. 60 Additionally, maintaining program usage information at server computer 8 helps ensure system integrity in the event of an abnormal termination of an application program launched by a monitored application, or even an abnormal termination of program monitor 4 itself. 65
Program monitor 4 next determines whether the task being processed is a new task (Step 130). This may be
accomplished, for example, by searching the application records in local record file 5 for a record having a TaskID matching the task identifier in the callback message. Where a task is being started, this decision should always have an affirmative result because task records are normally purged after a task ends. Assuming no task record is found, program monitor 4 determines whether the present task is associated with a previously-launched application and, if so, builds a new task record in local record file 5 using the appropriate TaskID and LaunchID, setting the parent/child indicator to flag the task as a child task (Step 171).
The foregoing describes the processing which may be performed when a callback message received by program monitor 4 relates to a task being started. Where the callback message relates instead to a task that is ending, program monitor 4 determines whether the task is associated with an application that was launched by graphical user interface 3 (Step 140). As above, this may be accomplished by searching local record file 5 for an entry having a TaskID matching the task identifier in the callback message. If a match is found, program monitor 4 removes the task record from local record file 5 (Step 181) and checks whether any other tasks are active for the application (Step 200). If the terminating task is the last active task, program monitor 4 calls server computer 8 to retrieve the current system time from remote timer 11 and records that time in the EndDateTime field of the appropriate application record in local record file 5 (Step 201). Program monitor 4 then reports this "final" EndDateTime to server computer 8 (Step 202). Upon receipt of a confirmation from server computer 8 that remote database 10 was updated with the EndDateTime, program monitor 4 deletes the application record from local record file 5 (Step 203).
In the processing described above, program monitor 4 acted upon callback messages from operating system 2. Additionally, or alternatively, program monitor 4 may perform certain processing on a periodic basis. For example, at timed intervals program monitor 4 may retrieve the current system time from server computer 8 to update the default EndDateTimes for all monitored applications represented in local record file 5 (Step 161). Likewise, program monitor 4 may report these updated default EndDateTimes to server computer 8 (Step 162). Program monitor 4 may also perform file maintenance at periodic intervals, such as deleting records from local record file 5 that relate to tasks 6 that are no longer active (and that have no active subtasks 7).
As illustrated in FIG. 2, program monitor 4 may also perform special processing at start-up (Step 100) and termination (Step 150). For example, when a user of client computer 1 starts graphical user interface 3, program monitor 4 may first process any "unreported" application records in local record file 5. Such records might result from an abnormal termination of graphical user interface 3, in which case local record file 5 could contain application records relating to tasks that also abnormally terminated or that terminated normally while graphical user interface 3 was not running. In either case, it is desirable for program monitor 4 to report a final EndDateTime to server computer 8. Assuming program monitor 4 had been periodically updating the default EndDateTimes in local record file 5 as described above, the unreported application record should already contain the best available approximation of the actual end time for applications being monitored when graphical user interface 3 terminated. Accordingly, program monitor 4 need only report these EndDateTimes to server computer 8 (Step 111). Upon receipt of confirmation that remote database 10 was successfully updated, program monitor 4 may purge the old application records from local record file 5.
When a user of client computer 1 requests that graphical user interface 3 be terminated (Step 150), program monitor 4 preferably issues a message warning the user that any active applications may be terminated, and asking the user to confirm the request (Step 190). Assuming the user confirms, program monitor 4 causes all tasks associated with applications being monitored to terminate (Step 191). For each such application, program monitor 4 updates the corresponding records in local record file 5 with the final EndDateTimes (Step 192). To determine the final EndDateTimes, program monitor 4 may again retrieve the current system time from server computer 8, or it may use a locally-maintained time derived from the most recently retrieved system time. Program monitor 4 then reports the EndDateTimes for each application that was terminated to server computer 8 (Step 193). Upon receipt of a confirmation from server computer 8 that remote database 10 was updated with the EndDate Time, program monitor 4 deletes the application records from local record file 5 (Step 194) and terminates execution.
While the description of the foregoing embodiment of program monitor 4 assumed operating system 2 generated callback messages whenever tasks were started or stopped, an alternate approach may be used to track program usage where operating system 2 lacks such callback capability. On a periodic basis, program monitor 4 may poll operating system 2 looking for active tasks. So long as operating system 2 maintains unique identifiers for active tasks, program monitor 4 may track program usage in essentially the same manner as described above. Rather than being informed of task starts and stops by operating system 2, however, program monitor 4 deduces this information from the presence or absence of active tasks and subtasks. In this latter embodiment, the accuracy of the application start and stop times provided by program monitor 4 will depend upon the length of time between polls. Shortening the polling interval will increase the accuracy of the application usage times.
The following describes a record layout for local record file 5 according to an embodiment of the present invention. As shown, local record file 5 may be segmented into sections containing one or more fields. The particular order of the sections is not critical. Section names are designated by brackets ("[. . .]"), while field names are designated by opposing arrowheads ("<. . .>").
Application Usage Header Section
An identifier assigned by the graphical user
interface which may be used to
unambiguously associate applications with a
particular user and/or session.
Application Message Section
Used to record errors occurring during
processing by the program monitor, such as
the inability to update the remote database
with application end times.
Application End Times Section
An identifier assigned by the program
monitor for an application launched by the
graphical user interface. For each LaunchID
in this file, there is a corresponding
[INLAPPLAUNCH] section with entries for
the parent task and any child tasks.
The number of launched applications
currently running. This number should equal
the number of LaunchlDs in this file.
Actual start time for the launched application,
preferably derived from trusted remote timer.
End time for the launched application,
initially set to default value for use at start-up
in the event the program monitor abnormally
terminated in its last session.
Name of service associated with launched
Drive path to launched application. Uniquely identifies an entry in the remote database associated with the launched application.
Number of active tasks and subtasks associated with the launched application.
Unique identifier for active parent task of launched application. There can be only one parent task for any given application. This identifier may be comprised of a LaunchID and an operating system-assigned task handle. Unique identifier for active child (subtask) of a launched application. There can be multiple subtasks for any given application. This identifier may be comprised of a LaunchID and an operating system-assigned task handle.
The above-described embodiments of the present invention may be applied, for example, in a system by which a local cable operator provides subscribers with access to a variety of on-line applications over a hybrid fiber coax network. By installing a program monitor such as that described above on the subscriber's personal computer, either as a stand-alone module or as part of a graphical user interface, the cable operator can monitor the on-line applications that any particular subscriber accesses. This information could be transmitted back to central computer maintained by the cable operator for use in generating usagebased bills or for compiling user profiles.
The foregoing is a detailed description of particular embodiments of the present invention as defined in the claims set forth below. The invention embraces all alternatives, modifications and variations that fall within the letter and spirit of the claims, as well as all equivalents of the claimed subject matter. For example, rather than being implemented in a client-server arrangement, embodiments of the present invention may be implemented in a LAN or some other distributed processing architecture. Persons skilled in the art will recognize from the foregoing detailed description that many other alternatives, modifications and variations are possible.
What is claimed is:
1. A method for monitoring execution time of an application program in a computer system, the application program being capable of spawning, either directly or indirectly, one or more associated application programs that execute independently from the application program, said method comprising the steps of:
detecting initiation of an application program; determining a first current system time corresponding to
the detected initiation; setting a starting time for the application program to the
first system time; tracking execution of the application program and its
associated application programs; detecting termination of the application program and
associated application programs; determining a second current system time corresponding to the detected termination of the application program
or a last-ending associated application program, whichever is later; and setting a final ending time for the application program to the second current system time.
2. The method of claim 1, wherein the computer system 5 is coupled to a remote computer including a timer, said steps of retrieving a first and second current system time including the step of retrieving a time value corresponding to a current system time from said timer.
3. The method of claim 1, wherein the computer system 10 is coupled to a remote computer, said method further comprising the step of reporting the starting and ending times for the application program to the remote computer.
4. The method of claim 3, wherein the computer system maintains a default ending time for the application program 15 while any associated application programs are executing, said method further comprising the steps of:
initializing the default ending time to the starting time for
the application program; periodically updating the default ending time for the 20
application program with a current system time; and periodically reporting the updated default ending time to
the remote computer.
5. The method of claim 4, further comprising the step of using the default ending time as a final ending time for the 25 application program when the computer system does not report a final ending time to the remote computer.
6. An instruction set residing on a storage medium for tracking program execution time on a computer system enabling a user to launch an application program capable of 30 spawning, either directly or indirectly, one or more other application programs that execute independently from the launched application program, said instruction set comprising instructions for:
detecting initiation of a launched application program;
determining a first current system time corresponding to the detected initiation;
setting a starting time for the launched application program to the first current system time; 40
tracking execution of the launched application program and any spawned application programs;
detecting termination of the launched application program and spawned application programs;
determining a second current system time corresponding 45 to the detected termination of the launched application program or a last-ending spawned application program, whichever is later; and
setting a final ending time for the launched application program to the second current system time. 50
7. The instruction set of claim 6, wherein the computer system is coupled to a remote computer, said instruction set further comprising instructions for transmitting information to the remote computer relating to program execution time for one or more launched application programs. 55
8. The instruction set of claim 7, further comprising instructions for periodically transmitting a default ending time for a launched application program to the remote computer while the launched application program or at least one spawned application program is executing, wherein the 60 default ending time is used as an estimated final ending time for the launched application program.
9. The instruction set of claim 8, wherein the computer system includes a local data store for maintaining information relating to execution times for a plurality of application 65 programs, said instruction set further comprising instructions for:
building a record in the local data store for each launched application program, the record including a starting time and an initialized default ending time for the launched application program;
periodically updating the default ending time in the local data store with a current system time while the launched application program or at least one spawned application program is executing; and
purging the record from the local data store upon confirmation by the remote computer that it successfully received a reported final ending time for the launched application program from the computer system.
10. The instruction set of claim 9, further comprising instructions for:
scanning the local data store for a record relating to a launched application program for which neither the launched application program nor a spawned application program is currently executing;
notifying the remote computer to use a default ending time for the launched application program as an estimated final ending time; and
purging the record from the local data store upon confirmation by the remote computer that it successfully set the estimated final ending time for the launched application program.
11. The instruction set of claim 6, wherein said storage medium comprises a portable magnetic storage device.
12. The instruction set of claim 6, wherein said storage medium comprises a downloadable data set residing on a remotely-accessible central computer.
13. The instruction set of claim 6, wherein said storage medium comprises a hard-disk of the computer system.
14. An apparatus for monitoring application program execution times in a computer system including an operating system configured to manage concurrent execution of one or more application programs, said apparatus comprising a software-implemented routine configured to determine a total execution time for an application program that spawns, either directly or indirectly, one or more other application programs that execute independently of the spawning application program, said total execution time being defined as a time period between initiation of the spawning application program and termination of either the spawning application program or a last-ended spawned application program, whichever is later.
15. The apparatus of claim 14, wherein said softwareimplemented routine is further configured to maintain a local data store including a record relating to each of said monitored application programs, said record including an application program identifier, a starting time and a default ending time for said application program.
16. The apparatus of claim 15, wherein the computer system is coupled to a remote computer maintaining a central database of information relating to execution times for a plurality of application programs executed by each of a plurality of uniquely identified computer systems, said software-implemented routine being further configured to periodically transmit information relating to execution time for one or more application programs to said remote computer, said transmitted information including a unique identifier for said computer system, said application program identifier, said starting time and said default ending time.
17. A client-server computer system for central tracking of execution times for application programs used by remote users , said client-server computer system comprising: