mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 06:47:17 +00:00
Estimated hours taken: 24 Branches: main Add two new command line tools "mslice" and "mdice", which manipulate slices and dices respectively. The functionality of "mdice" duplicates the functionality of mdb's current "dice" command, while the functionality of "mslice" is new. runtime/mercury_trace_base.[ch]: When generating trace count files, include information about the context of each execution count. While mdb has access to this information in the running program, mslice and mdice do not. In any case, the code in mdb for looking up this information was terribly inefficient. Provide a mechanism for recording all execution counts, even the zero ones, for use in coverage testing. This mechanism is not used yet. Put a header on trace counts files, to make them recognizable as such. Make this header indicate whether we are including zero trace counts. runtime/mercury_wrapper.c: Provide a flag in MERCURY_OPTIONS for turning on recording of zero execution counts. browser/dice.m: mdbcomp/slice_and_dice.m: Move most of the code of browser/dice.m to mdbcomp/slice_and_dice.m, much modified; browser/dice.m is now empty. The modifications are as follows. Factor out the code for reading dices, since dices are useful independent of mdb's dice command. Generalize the code for computing dices to allow either or both of the slices being subtracted to be specified as the union of one or more trace counts files. Add two more sort conditions for comparing the execution counts in two slices: ascending and descending versions of simple execution count differences. For each operation we have so far performed on dices, add code for performing that operation on slices. browser/mdb.m: Delete the include of dice.m, since it is now empty. Delete a duplicate include_module of term_rep, and delete the now unnecessary include_modules of set_cc and tree234_cc. mdbcomp/mdbcomp.m: Add slice_and_dice.m as a submodule. mdbcomp/trace_counts.m: Provide a mechanism to allow a slice to be specified as coming not from a single trace count file but from the union operation on a set of trace count files. Convert to four-space indentation to eliminate some excessively indented lines. slice/mdice.m: slice/mslice.m: The main modules of two new commands. Their functionality is almost entirely in mdbcomp/slice_and_dice.m and mdbcomp/trace_counts.m. slice/Mmakefile: New Mmakefile for building mslice and mdice. It is modelled on profiler/Mmakefile. slice/Mercury.options: Empty file, for use in the future. slice/.nocopyright: Don't require copyright notice in Mercury.options. Mmakefile: Process the slice directory at appropriate points when processing other directories. compiler/tupling.m: Conform to the updated interface of mdbcomp/trace_counts. library/list.m: Add versions of list__map for some more arities, for use in the code above. trace/mercury_trace_internal.c: Generalize the code for specifying dices to allow either or both of the slices being subtracted to be specified as the union of one or more trace counts files. Fix several places where we weren't checking the return value of malloc. Fix two places where we could conceivably free strings that were still alive. Fix some places where we could pass NULL strings to Mercury code, and some places where we could free NULL pointers (which, once upon a time, was not guaranteed to work on all platforms). Use existing functions such as MR_copy_string where appropriate. tests/run_one_test: Fix two small bugs in this script: make the filenames more user friendly, and make sure that gzip isn't asked to overwrite an existing file, since that causes it to ask a question on stdout and to wait for an answer. tools/bootcheck: Copy or link the slice directory into stage 2. Rename the --copy-profiler option as --copy-profilers, since it now copies three directories containing performance engineering tools: profiler, deep_profiler and slice.
65 lines
1.9 KiB
Mathematica
65 lines
1.9 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% Copyright (C) 1998-2005 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module mdb.
|
|
|
|
:- interface.
|
|
|
|
:- import_module mdbcomp.
|
|
|
|
:- pred mdb__version(string::out) is det.
|
|
|
|
% These interface modules are used directly by the test programs
|
|
% or the libmer_trace library.
|
|
:- include_module browse.
|
|
:- include_module browser_info.
|
|
:- include_module browser_term.
|
|
:- include_module collect_lib.
|
|
:- include_module cterm.
|
|
:- include_module debugger_interface.
|
|
:- include_module declarative_debugger.
|
|
:- include_module declarative_execution.
|
|
:- include_module help.
|
|
:- include_module interactive_query.
|
|
:- include_module io_action.
|
|
|
|
:- implementation.
|
|
|
|
:- include_module declarative_analyser.
|
|
:- include_module declarative_edt.
|
|
:- include_module declarative_oracle.
|
|
:- include_module declarative_tree.
|
|
:- include_module declarative_user.
|
|
:- include_module frame.
|
|
:- include_module parse.
|
|
:- include_module sized_pretty.
|
|
:- include_module util.
|
|
:- include_module term_rep.
|
|
|
|
% XXX these modules are more generally useful, but the
|
|
% dynamic linking library is not yet installed anywhere.
|
|
:- include_module dl.
|
|
:- include_module name_mangle.
|
|
|
|
% See library/library.m for why we implement this predicate this way.
|
|
|
|
:- pragma foreign_proc("C",
|
|
mdb__version(Version::out),
|
|
[will_not_call_mercury, promise_pure, thread_safe],
|
|
"
|
|
MR_ConstString version_string =
|
|
MR_VERSION "", configured for "" MR_FULLARCH;
|
|
/*
|
|
** Cast away const needed here, because Mercury declares Version
|
|
** with type MR_String rather than MR_ConstString.
|
|
*/
|
|
Version = (MR_String) (MR_Word) version_string;
|
|
").
|
|
|
|
mdb__version("unknown version").
|
|
|
|
%---------------------------------------------------------------------------%
|