-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#5538 memtrace seek, part 7: Add instr count to tools
Adds a new memref_stream_t interface class which provides the record and instruction count to drmemtrace analysis tools. A pointer to this interface is passed to new extended-argument versions of analysis_tool_t's initialize() and parallel_shard_init() functions, which are now what is called by the analyzer. The base class implementation of these new functions simply calls the old versions, which are now deprecated but will continue to work. This new interface is not just for convenience: the tool itself cannot accurately count when the reader skips over records, as will happen with seeking. The counting must be done in the reader. (If the tool indeed wants to count only records/instrs that it actually sees, it can continue using its own counters.) Updates the view tool to use the new interface to obtain the record ordinal, replacing its own counter. The tool is expanded to print a new column with the instruction ordinal. The view tool test is updated along with example output in the docs. Issue: #5538
- Loading branch information
1 parent
a2b1d4b
commit 7591b46
Showing
13 changed files
with
353 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* ********************************************************** | ||
* Copyright (c) 2022 Google, Inc. All rights reserved. | ||
* **********************************************************/ | ||
|
||
/* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* * Neither the name of Google, Inc. nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
* DAMAGE. | ||
*/ | ||
|
||
/* memref_stream: represent a memory trace analysis tool. | ||
*/ | ||
|
||
#ifndef _MEMREF_STREAM_H_ | ||
#define _MEMREF_STREAM_H_ 1 | ||
|
||
/** | ||
* @file drmemtrace/memref_stream.h | ||
* @brief DrMemtrace interface for obtaining information from analysis | ||
* tools on the full stream of memory reference records. | ||
*/ | ||
|
||
/** | ||
* This is an interface for obtaining information from analysis tools | ||
* on the full stream of memory reference records. | ||
*/ | ||
class memref_stream_t { | ||
public: | ||
/** Destructor. */ | ||
virtual ~memref_stream_t() | ||
{ | ||
} | ||
/** | ||
* Returns the count of #memref_t records from the start of the trace to this point. | ||
* This includes records skipped over and not presented to any tool. | ||
*/ | ||
virtual uint64_t | ||
get_record_ordinal() = 0; | ||
/** | ||
* Returns the count of instructions from the start of the trace to this point. | ||
* This includes instructions skipped over and not presented to any tool. | ||
*/ | ||
virtual uint64_t | ||
get_instruction_ordinal() = 0; | ||
}; | ||
|
||
#endif /* _MEMREF_STREAM_H_ */ |
Oops, something went wrong.