The present invention relates generally to a method, system, and computer program product for value profiling. More particularly, the present invention relates to a method, system, and computer program product for software-directed value profiling with a hardware-based guarded storage facility.
Software profiling is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. Most commonly, profiling information serves to aid program optimization. Profiling is achieved by instrumenting either the program source code or its binary executable form using a tool called a profiler or code profiler. Profilers employ a variety of techniques to collect data, including hardware interrupts, code instrumentation, instruction set simulation, profiling hooks, A profiling hook is an instruction, either in a higher level language of the source code or an executable instruction in a suitable form depending upon the specific implementation, designed to invoke, as a result of executing the instruction, an operation relating to profiling a portion of code that is expressly or implicitly identified by the instruction.
A Guarded Storage (GS) Facility is a hardware-based feature that allows a program to guard or monitor region(s) in memory, such that performing a load of a reference to a guarded region triggers not only the primary operation contemplated in the instruction that makes the reference but an additional user configurable instruction. A load operation that references a region that is guarded is referred to herein as a guarded load. The additional user configurable instructions presently implement garbage collection instructions, which enable garbage collection and heap management while a guarded region is in use in other ways.
For example, a presently available data processing system implements an area of memory that is mapped and registered to the GS Facility as the GS area. A memory management subsystem subdivides this GS area into a set of sections, for example, 64 sections, and provides a masking capability to selectively enable a subset of these 64 sections to be guarded. At the start of a scavenge cycle, the mask corresponding to the allocated space of the area is selectively enabled. During the scavenge cycle, any object references loaded by the application threads are done using a new set of guarded load instructions. When the data processing system executes a guarded load instruction, if the GS facility is enabled, the memory management subsystem determines whether the value being loaded is part of any of the active guarded sections. If the value is part of a guarded region, the GS facility triggers a user configured action, which presently is a method to perform garbage collection in conjunction with accessing the data from the region. At the end of the scavenge cycle, the guarded storage facility is disabled across all threads.
Embodiments of the invention are defined by the claims below, not this summary A high-level overview is provided here to provide an overview of the disclosure, and to introduce a selection of concepts that are further described below in the detailed-description section below. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in isolation to determine the scope of the claimed subject matter.
The illustrative embodiments provide a method, system, and computer program product. An embodiment includes a method that loads, during an execution of a code, a first instruction having a first value designating a first region of memory. In this regard, the first instruction is related to a first section of the code. An embodiment determines whether a guarded mode is enabled at the first region. An embodiment triggers a secondary operation, responsive to the guarded mode being enabled at the first region. The secondary operation is in addition to a primary operation of the first instruction. The primary operation is relative to the first region of the memory. The secondary operation causes a profiling of the first section of the code.
An embodiment includes a computer usable program product. The computer usable program product includes one or more computer-readable storage devices, and program instructions stored on at least one of the one or more storage devices.
An embodiment includes a computer system. The computer system includes one or more processors, one or more computer-readable memories, and one or more computer-readable storage devices, and program instructions stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories.
Certain novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of the illustrative embodiments when read in conjunction with the accompanying drawings, wherein:
The illustrative embodiments recognize that there is a need to reduce the overhead cost of value profiling of a running application. For example, employing a deterministic approach by instrumenting profiling hooks into relevant codepoints that check against a flag to enable or disable profiling, or the use of a counter to trigger the profiling logic produce a non-negligible cost in overhead. This overhead cost is primarily attributed to instrumenting the profiling logic. Moreover, such deterministic approaches also impact application performance. Other approaches leverage hardware interrupts for sampling the executed code, but restrict the data that is collected, as the sampling is limited to the sampling locations. By limiting the sampling locations, the potential for incomplete and/or biased samples increases.
In addition, the use of profiling hooks in current profiling techniques require higher overhead costs because the codepoint checks for an “on” or “off” flag to enable or disable profiling cannot be easily disabled or mitigated.
The illustrative embodiments recognize that the presently available solutions do not address these needs or provide adequate solutions for these needs. The illustrative embodiments used to describe the invention generally address and solve the above-described problems and other problems related to reducing overhead cost of value profiling a running application while providing greater flexibility in the management of profiling operations.
An embodiment can be implemented as a software application. The application implementing an embodiment can be configured as a modification of an existing value profiling system, as a separate application that operates in conjunction with an existing value profiling system, a standalone application, or some combination thereof.
Particularly, some illustrative embodiments provide a method that leverages a guarded storage (GS) facility/memory manager with instrumented, profiling hooks. The GS facility/memory manager produces lightweight, guarded load instructions, resulting in little to no performance overhead. The additional user configurable instructions contemplated within the scope of the illustrative embodiments can take any suitable form, including but are not limited to invoking an interrupt handler that is configured to cause a profiling operation to occur. Another alternative implementation capable of initializing the profiling operation includes invoking, as a part of triggering the profiling operation, an instruction encoded in a device driver. In this regard, the loading of the first instruction causes the device driver to be invoked, and the invoked device driver causes the profiling operation. Another alternative implementation includes invoking, as part of triggering the profiling operation, an instruction encoded in a memory management subsystem. In this regard, the loading of the first instruction causes the memory management subsystem to start the profiling operation.
According to one embodiment, a first instruction is loaded during an execution of a code. The loaded first instruction is a hook instruction. The first instruction has a first value designating a first region of memory, and the first instruction is related to a first section of the code. Using a guarded storage facility/memory manager (GSF/MM), a determination is made whether a guarded mode is enabled at the first region. This enablement determination can be performed before or during runtime operations. At the GSF/MM, a comparison is made between the received operand indicating the memory address of the loaded instruction and a guarded memory address. If the guarded mode is enabled by the GSF/MM at the first region and the loaded address is a match to a guarded address region, the loaded instruction will perform its primary operation of executing the instruction, as well as the secondary operation of invoking a guarded interrupt handler to handle the profiling operations associated with the executed instruction at the first section of code. In one embodiment, the guarded mode is selectively enabled on a per-thread basis.
In another embodiment, a second instruction different from the first instruction is loaded during the execution of the code. The second instruction has a second value designating a second region of memory, and the second instruction is related to a second section of the code. The second instruction includes a second profiling hook. As with the first instruction, a determination is made by the GSF/MM whether a guarded mode is enabled at the second region. Responsive to the guarded mode being disabled at the second region, the second instruction is notably executed as normal, without the invocation of the interrupt handler and without profiling the second section of code, thus preventing the second profiling hook associated with the second region from performing a guarded action.
In view of the foregoing embodiments, the ability to selectively guard one region and not another allows for greater runtime control of the profiling techniques employed. The above examples of selectively enabling a GSF/MM in such granular fashion so as to cause the invocation of an interrupt handler to handle profiling operations on particular regions of executed code is not meant to be limiting in any way. From this disclosure, those of ordinary skill in the art will be able to conceive many other ways of implementing a profiling operation and the same are contemplated within the scope of the illustrative embodiments.
The manner of value profiling described herein is unavailable in the presently available methods in the technological field of endeavor pertaining to value profiling and code optimization. A method of an embodiment described herein, when implemented to execute on a device or data processing system, comprises substantial advancement of the functionality of that device or data processing system by leveraging the built-in features of a Guarded Storage (GS) facility/Memory Manager for triggering the execution of value profiling operations.
The illustrative embodiments are described with respect to certain types of computer memories, storage devices, memory managers, profiling systems, profiling hook/instructions, cloud computing systems, virtual computing systems, operating systems, computing systems, server systems, data processing systems, networked computing environments, devices, guarded storage facilities, guarded load instructions, other environments, components, and applications only as examples. Any specific manifestations of these and other similar artifacts are not intended to be limiting to the invention. Any suitable manifestation of these and other similar artifacts can be selected within the scope of the illustrative embodiments.
Furthermore, the illustrative embodiments may be implemented with respect to any type of data/instruction, data/instruction source, or access to a data/instruction source over a data network. Any type of data/instruction storage device may provide the data/instruction to an embodiment of the invention, either locally at a data processing system or over a data network, within the scope of the invention.
The illustrative embodiments are described using specific code, designs, architectures, protocols, layouts, schematics, and tools only as examples and are not limiting to the illustrative embodiments. Furthermore, the illustrative embodiments are described in some instances using particular software, tools, and data processing environments only as an example for the clarity of the description. The illustrative embodiments may be used in conjunction with other comparable or similarly purposed structures, systems, applications, or architectures. For example, other comparable computing devices, structures, systems, applications, or architectures therefor, may be used in conjunction with such embodiment of the invention within the scope of the invention. An illustrative embodiment may be implemented in hardware, software, or a combination thereof.
The examples in this disclosure are used only for the clarity of the description and are not limiting to the illustrative embodiments. Additional data, operations, actions, tasks, activities, and manipulations will be conceivable from this disclosure and the same are contemplated within the scope of the illustrative embodiments.
Any advantages listed herein are only examples and are not intended to be limiting to the illustrative embodiments. Additional or different advantages may be realized by specific illustrative embodiments. Furthermore, a particular illustrative embodiment may have some, all, or none of the advantages listed above.
With reference to the figures and in particular with reference to
Clients or servers are only example roles of certain data processing systems connected to network 102 and are not intended to exclude other configurations or roles for these data processing systems. Server 104 and server 106 couple to network 102 along with storage unit 108. Software applications may execute on any computer in data processing environment 100. Clients 110, 112, and 114 are also coupled to network 102. A data processing system, such as server 104 or 106, or client 110, 112, or 114 may contain data and may have software applications or software tools executing thereon.
Only as an example, and without implying any limitation to such architecture,
Device 132 is an example of a device described herein. For example, device 132 can take the form of a smartphone, a tablet computer, a laptop computer, client 110 in a stationary or a portable form, a wearable computing device, or any other suitable device. Any software application described as executing in another data processing system in
Application 105 implements an embodiment described herein. Application 105 can also execute in any of data processing systems 104, 106, 110, 112, and 114. Servers 104 and 106, storage unit 108, and clients 110, 112, and 114, and device 132 may couple to network 102 using wired connections, wireless communication protocols, or other suitable data connectivity. Clients 110, 112, and 114 may be, for example, personal computers or network computers.
In the depicted example, server 104 may provide data, such as boot files, operating system images, and applications to clients 110, 112, and 114. Clients 110, 112, and 114 may be clients to server 104 in this example. Clients 110, 112, 114, or some combination thereof, may include their own data, boot files, operating system images, and applications. Data processing environment 100 may include additional servers, clients, and other devices that are not shown.
In the depicted example, data processing environment 100 may be the Internet. Network 102 may represent a collection of networks and gateways that use the Transmission Control Protocol/Internet Protocol (TCP/IP) and other protocols to communicate with one another. At the heart of the Internet is a backbone of data communication links between major nodes or host computers, including thousands of commercial, governmental, educational, and other computer systems that route data and messages. Of course, data processing environment 100 also may be implemented as a number of different types of networks, such as for example, an intranet, a local area network (LAN), or a wide area network (WAN).
Among other uses, data processing environment 100 may be used for implementing a client-server environment in which the illustrative embodiments may be implemented. A client-server environment enables software applications and data to be distributed across a network such that an application functions by using the interactivity between a client data processing system and a server data processing system. Data processing environment 100 may also employ a service-oriented architecture where interoperable software components distributed across a network may be packaged together as coherent business applications. Data processing environment 100 may also take the form of a cloud, and employ a cloud computing model of service delivery for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g. networks, network bandwidth, servers, processing, memory, storage, applications, virtual machines, and services) that can be rapidly provisioned and released with minimal management effort or interaction with a provider of the service.
With reference to
Data processing system 200 is also representative of a data processing system or a configuration therein, such as data processing system 132 in
In the depicted example, data processing system 200 employs a hub architecture including North Bridge and memory controller hub (NB/MCH) 202 and South Bridge and input/output (I/O) controller hub (SB/ICH) 204. Processing unit 206, main memory 208, and graphics processor 210 are coupled to North Bridge and memory controller hub (NB/MCH) 202. Processing unit 206 may contain one or more processors and may be implemented using one or more heterogeneous processor systems. Processing unit 206 may be a multi-core processor. Graphics processor 210 may be coupled to NB/MCH 202 through an accelerated graphics port (AGP) in certain implementations.
In the depicted example, local area network (LAN) adapter 212 is coupled to South Bridge and
I/O controller hub (SB/ICH) 204. Audio adapter 216, keyboard and mouse adapter 220, modem 222, read only memory (ROM) 224, universal serial bus (USB) and other ports 232, and PCI/PCIe devices 234 are coupled to South Bridge and I/O controller hub 204 through bus 238. Hard disk drive (HDD) or solid-state drive (SSD) 226 and CD-ROM 230 are coupled to South Bridge and I/O controller hub 204 through bus 240. PCI/PCIe devices 234 may include, for example, Ethernet adapters, add-in cards, and PC cards for notebook computers. PCI uses a card bus controller, while PCIe does not. ROM 224 may be, for example, a flash binary input/output system (BIOS). Hard disk drive 226 and CD-ROM 230 may use, for example, an integrated drive electronics (IDE), serial advanced technology attachment (SATA) interface, or variants such as external-SATA (eSATA) and micro-SATA (mSATA). A super I/O (SIO) device 236 may be coupled to South Bridge and I/O controller hub (SB/ICH) 204 through bus 238.
Memories, such as main memory 208, ROM 224, or flash memory (not shown), are some examples of computer usable storage devices. Hard disk drive or solid state drive 226, CD-ROM 230, and other similarly usable devices are some examples of computer usable storage devices including a computer usable storage medium.
An operating system runs on processing unit 206. The operating system coordinates and provides control of various components within data processing system 200 in
Instructions for the operating system, the object-oriented programming system, and applications or programs, such as application 105 in
Furthermore, in one case, code 226A may be downloaded over network 201A from remote system 201B, where similar code 201C is stored on a storage device 201D. in another case, code 226A may be downloaded over network 201A to remote system 201B, where downloaded code 201C is stored on a storage device 201D.
The hardware in
According to one exemplary embodiment, the computing environment 200 and/or remote system 201B is based on the z/Architecture, offered by International Business Machines Corporation, Armonk, N.Y. One embodiment of the z/Architecture is described in “z/Architecture Principles of Operation,” IBM Publication No. SA22-7832-11, March 2017, which is hereby incorporated herein by reference in its entirety. Z/ARCHITECTURE is a registered trademark of International Business Machines Corporation, Armonk, N.Y., USA.
The computing environment may also be based on other architectures, including but not limited to, the Intel x86 architectures. Other examples also exist.
In some illustrative examples, data processing system 200 may be a personal digital assistant (PDA), which is generally configured with flash memory to provide non-volatile memory for storing operating system files and/or user-generated data. A bus system may comprise one or more buses, such as a system bus, an I/O bus, and a PCI bus. Of course, the bus system may be implemented using any type of communications fabric or architecture that provides for a transfer of data between different components or devices attached to the fabric or architecture.
A communications unit may include one or more devices used to transmit and receive data, such as a modem or a network adapter. A memory may be, for example, main memory 208 or a cache, such as the cache found in North Bridge and memory controller hub 202. A processing unit may include one or more processors or CPUs.
The depicted examples in
Where a computer or data processing system is described as a virtual machine, a virtual device, or a virtual component, the virtual machine, virtual device, or the virtual component operates in the manner of data processing system 200 using virtualized manifestation of some or all components depicted in data processing system 200. For example, in a virtual machine, virtual device, or virtual component, processing unit 206 is manifested as a virtualized instance of all or some number of hardware processing units 206 available in a host data processing system, main memory 208 is manifested as a virtualized instance of all or some portion of main memory 208 that may be available in the host data processing system, and disk 226 is manifested as a virtualized instance of all or some portion of disk 226 that may be available in the host data processing system. The host data processing system in such cases is represented by data processing system 200.
With reference to
Processor 206 also includes, in one embodiment, one or more registers 260 to be used by one or more of the functional components.
With reference to
Native CPU 306 includes, one or more native registers 314, such as one or more general purpose registers and/or one or more special purpose registers used during processing within the environment. These registers include information at represents the state of the environment at any particular point in time.
Moreover, native CPU 306 executes instructions and code that are stored in memory 308. In one particular example, the central processing unit executes emulator code 316 stored in memory 308. This code enables the computing environment configured in one architecture to emulate another architecture. For instance, emulator code 316 allows machines based on architectures other than the z/Architecture, such as PowerPC processors, pSeries servers, or other servers or processors, to emulate the z/Architecture and to execute software and instructions developed based on the z/Architecture.
Further details relating to emulator code 316 are described with reference to
Further, emulator code 316 includes an emulation control routine 360 to cause the native instructions 356 to be executed. Emulation control routine 360 may cause native CPU 306 to execute a routine of native instructions 356 that emulate one or more previously obtained guest instructions 350 and, at the conclusion of such execution, return control to the instruction fetch routine 352 to emulate the obtaining of the next guest instruction 350 or a group of guest instructions. Execution of native instructions 356 may include loading data into a register from memory 308; storing data back to memory from a register; or performing some type of arithmetic or logic operation, as determined by the translation routine 354.
Each routine is, for instance, implemented in software, which is stored in memory and executed by native CPU 306. In other examples, one or more of the routines or operations are implemented in firmware, hardware, software or some combination thereof. The registers of the emulated processor may be emulated using registers 314 of the native CPU 306 or by using locations in memory 308. In embodiments, guest instructions 350, native instructions 356 and emulator code 316 may reside in the same memory or may be disbursed among different memory devices.
As used herein, firmware includes, e.g., the microcode or Millicode of the processor. It includes, for instance, the hardware-level instructions and/or data structures used in implementation of higher level machine code. In one embodiment, it includes, for instance, proprietary code that is typically delivered as microcode that includes trusted software or microcode specific to the underlying hardware and controls operating system access to the system hardware.
A guest instruction 350 that is obtained, translated and executed is, for instance, an instruction of the guarded storage facility/memory manager (GSF/MM)(shown below in
Details relating to one embodiment of a GSF/MM 412, including instructions associated therewith, are described below. The GSF/MM 412 provides a mechanism by which a program can designate an area of logical storage comprising a number of guarded storage sections (e.g., 0 to 64), and may be used, e.g., by various programming languages that implement storage reclamation techniques. The facility includes, for instance, a number of instructions, such as, for example guarded load instructions.
With reference now to exemplary instruction 400 shown in
With reference now to
With reference to
With reference to
With reference to
Thus, a computer implemented method, system or apparatus, and computer program product are provided in the illustrative embodiments for software-directed value profiling with hardware-based guarded storage facility and other related features, functions, or operations. Where an embodiment or a portion thereof is described with respect to a type of device, the computer implemented method, system or apparatus, the computer program product, or a portion thereof, are adapted or configured for use with a suitable and comparable manifestation of that type of device.
Where an embodiment is described as implemented in an application, the delivery of the application in a Software as a Service (SaaS) model is contemplated within the scope of the illustrative embodiments. In a SaaS model, the capability of the application implementing an embodiment is provided to a user by executing the application in a cloud infrastructure. The user can access the application using a variety of client devices through a thin client interface such as a web browser (e.g., web-based e-mail), or other light-weight client-applications. The user does not manage or control the underlying cloud infrastructure including the network, servers, operating systems, or the storage of the cloud infrastructure. In some cases, the user may not even manage or control the capabilities of the SaaS application. In some other cases, the SaaS implementation of the application may permit a possible exception of limited user-specific application configuration settings.
The present invention may be a system, a method, and/or a computer program product at any possible technical detail level of integration. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, configuration data for integrated circuitry, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++, or the like, and procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the Figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.