summaryrefslogtreecommitdiffstats
path: root/doc/RecordEval.3
diff options
context:
space:
mode:
authorrjohnson <rjohnson>1998-03-26 14:45:59 (GMT)
committerrjohnson <rjohnson>1998-03-26 14:45:59 (GMT)
commit2b5738da524e944cda39e24c0a87b745a43bd8c3 (patch)
tree6e8c9473978f6dab66c601e911721a7bd9d70b1b /doc/RecordEval.3
parentc6a259aeeca4814a97cf6694814c63e74e4e18fa (diff)
downloadtcl-2b5738da524e944cda39e24c0a87b745a43bd8c3.zip
tcl-2b5738da524e944cda39e24c0a87b745a43bd8c3.tar.gz
tcl-2b5738da524e944cda39e24c0a87b745a43bd8c3.tar.bz2
Initial revision
Diffstat (limited to 'doc/RecordEval.3')
-rw-r--r--doc/RecordEval.357
1 files changed, 57 insertions, 0 deletions
diff --git a/doc/RecordEval.3 b/doc/RecordEval.3
new file mode 100644
index 0000000..17d353d
--- /dev/null
+++ b/doc/RecordEval.3
@@ -0,0 +1,57 @@
+'\"
+'\" Copyright (c) 1989-1993 The Regents of the University of California.
+'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+'\" SCCS: @(#) RecordEval.3 1.18 97/07/29 18:25:13
+'\"
+.so man.macros
+.TH Tcl_RecordAndEval 3 7.4 Tcl "Tcl Library Procedures"
+.BS
+.SH NAME
+Tcl_RecordAndEval \- save command on history list before evaluating
+.SH SYNOPSIS
+.nf
+\fB#include <tcl.h>\fR
+.sp
+int
+\fBTcl_RecordAndEval\fR(\fIinterp, cmd, flags\fR)
+.SH ARGUMENTS
+.AS Tcl_Interp *interp;
+.AP Tcl_Interp *interp in
+Tcl interpreter in which to evaluate command.
+.AP char *cmd in
+Command (or sequence of commands) to execute.
+.AP int flags in
+An OR'ed combination of flag bits. TCL_NO_EVAL means record the
+command but don't evaluate it. TCL_EVAL_GLOBAL means evaluate
+the command at global level instead of the current stack level.
+.BE
+
+.SH DESCRIPTION
+.PP
+\fBTcl_RecordAndEval\fR is invoked to record a command as an event
+on the history list and then execute it using \fBTcl_Eval\fR
+(or \fBTcl_GlobalEval\fR if the TCL_EVAL_GLOBAL bit is set in \fIflags\fR).
+It returns a completion code such as TCL_OK just like \fBTcl_Eval\fR
+and it leaves information in \fIinterp->result\fR.
+If you don't want the command recorded on the history list then
+you should invoke \fBTcl_Eval\fR instead of \fBTcl_RecordAndEval\fR.
+Normally \fBTcl_RecordAndEval\fR is only called with top-level
+commands typed by the user, since the purpose of history is to
+allow the user to re-issue recently-invoked commands.
+If the \fIflags\fR argument contains the TCL_NO_EVAL bit then
+the command is recorded without being evaluated.
+.PP
+Note that \fBTcl_RecordAndEval\fR has been largely replaced by the
+object-based procedure \fBTcl_RecordAndEvalObj\fR.
+That object-based procedure records and optionally executes
+a command held in a Tcl object instead of a string.
+
+.SH "SEE ALSO"
+Tcl_RecordAndEvalObj
+
+.SH KEYWORDS
+command, event, execute, history, interpreter, record
ly to H5C_insert_entry():
+ *
+ * H5C__SET_FLUSH_MARKER_FLAG
+ * H5C__PIN_ENTRY_FLAG
+ *
+ * These flags apply to H5C_unprotect():
+ *
+ * H5C__SET_FLUSH_MARKER_FLAG
+ * H5C__DELETED_FLAG
+ * H5C__DIRTIED_FLAG
+ * H5C__SIZE_CHANGED_FLAG
+ * H5C__PIN_ENTRY_FLAG
+ * H5C__UNPIN_ENTRY_FLAG
+ *
+ *
+ * These flags apply to H5C_flush_cache():
+ *
+ * H5C__FLUSH_INVALIDATE_FLAG
+ * H5C__FLUSH_CLEAR_ONLY_FLAG
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG
+ * H5C__FLUSH_IGNORE_PROTECTED_FLAG (can't use this flag in combination
+ * with H5C__FLUSH_INVALIDATE_FLAG)
+ *
+ * These flags apply to H5C_flush_single_entry():
+ *
+ * H5C__FLUSH_INVALIDATE_FLAG
+ * H5C__FLUSH_CLEAR_ONLY_FLAG
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG
*/
-/* Generic "no flags set" value for all function calls */
#define H5C__NO_FLAGS_SET 0x0000
-
-/* These flags apply to H5C_insert_entry() & H5C_unprotect() */
#define H5C__SET_FLUSH_MARKER_FLAG 0x0001
#define H5C__DELETED_FLAG 0x0002
-
-/* These flags applies only to H5C_unprotect() */
#define H5C__DIRTIED_FLAG 0x0004
#define H5C__SIZE_CHANGED_FLAG 0x0008
#define H5C__PIN_ENTRY_FLAG 0x0010
#define H5C__UNPIN_ENTRY_FLAG 0x0020
-
-/* These flags apply to H5C_flush_cache() & H5C_flush_single_entry() */
#define H5C__FLUSH_INVALIDATE_FLAG 0x0040
#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x0080
#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x0100
-
-/* This flag applies to H5C_flush_cache() only. It is an error to use
- * it in combination with the H5C__FLUSH_INVALIDATE_FLAG
- */
#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x0200
diff --git a/test/cache.c b/test/cache.c
index 98f68d5..440b5e3 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -34,6 +34,7 @@ static void smoke_check_6(void);
static void smoke_check_7(void);
static void smoke_check_8(void);
static void write_permitted_check(void);
+static void check_insert_entry(void);
static void check_flush_cache(void);
static void check_flush_cache__empty_cache(H5C_t * cache_ptr);
static void check_flush_cache__multi_entry(H5C_t * cache_ptr);
@@ -2000,6 +2001,308 @@ write_permitted_check(void)
/*-------------------------------------------------------------------------
+ * Function: check_insert_entry()
+ *
+ * Purpose: Verify that H5C_insert_entry behaves as expected.
+ * Test the behaviour with different flags.
+ *
+ * This test was added primarily to test basic insert
+ * pinned entry functionallity, but I through in explicit
+ * tests for other functionallity that is tested implicitly
+ * elsewhere.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 8/10/06
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+check_insert_entry(void)
+{
+ const char * fcn_name = "check_insert_entry";
+ int entry_type = PICO_ENTRY_TYPE;
+ int i;
+ herr_t result;
+ hbool_t in_cache;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ size_t entry_size;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t * base_addr;
+ test_entry_t * entry_ptr;
+ struct H5C_cache_entry_t * search_ptr;
+
+
+ TESTING("H5C_insert_entry() functionality");
+
+ pass = TRUE;
+
+ /* Allocate a cache, and insert entries into it using all
+ * combinations of flags. Verify that the entries are inserted,
+ * and that the flags have the desired effects.
+ *
+ * Note that the dirty parameter in insert_entry is no longer
+ * used, as we have decided that all inserted entries are
+ * dirty by definition. (Which sounds very reasonable, but didn't
+ * used to be the case.)
+ */
+
+ if ( pass ) {
+
+ reset_entries();
+
+ cache_ptr = setup_cache((size_t)(2 * 1024 * 1024),
+ (size_t)(1 * 1024 * 1024));
+ }
+
+ if ( pass ) {
+
+ insert_entry(cache_ptr, entry_type, 0, TRUE, H5C__NO_FLAGS_SET);
+ insert_entry(cache_ptr, entry_type, 1, TRUE,
+ H5C__SET_FLUSH_MARKER_FLAG);
+ insert_entry(cache_ptr, entry_type, 2, TRUE, H5C__PIN_ENTRY_FLAG);
+ insert_entry(cache_ptr, entry_type, 3, TRUE,
+ (H5C__SET_FLUSH_MARKER_FLAG | H5C__PIN_ENTRY_FLAG));
+ }
+
+
+ /* Verify that the entries are inserted as desired. */
+
+ i = 0;
+ base_addr = entries[0];
+ while ( ( pass ) && ( i < 4 ) )
+ {
+ entry_ptr = &(base_addr[i]);
+
+ /* Start by checking everything we can via H5C_get_entry_status() */
+
+ result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size,
+ &in_cache, &is_dirty, &is_protected,
+ &is_pinned);
+
+ if ( result < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5AC_get_entry_status() reports failure.";
+ }
+
+ if ( pass ) {
+
+ /* check the universals */
+ if ( ( ! in_cache ) || ( ! is_dirty ) || ( is_protected ) ||
+ ( entry_size != entry_sizes[entry_type] ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 1.";
+ }
+ }
+
+ if ( pass ) {
+
+ /* verify that the pinned flag got set correctly */
+ if ( ( i == 2 ) || ( i == 3 ) ) {
+
+ if ( ! is_pinned ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 2.";
+ }
+ } else if ( is_pinned ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 3.";
+
+ } else if ( is_pinned != ((entry_ptr->header).is_pinned) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 4.";
+ }
+ }
+
+ /* Thats all we can get from H5AC_get_entry_status().
+ * Now start looking at the cache data structures directly.
+ */
+
+ if ( pass ) {
+
+ /* Verify that the flush marker got set correctly */
+ if ( ( i == 1 ) || ( i == 3 ) ) {
+
+ if ( ! ((entry_ptr->header).flush_marker) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 5.";
+ }
+ } else if ( (entry_ptr->header).flush_marker ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 6.";
+ }
+ }
+
+ if ( pass ) {
+
+ /* Verify that pinned entries are in the pinned entry list */
+ if ( (entry_ptr->header).is_pinned ) {
+
+ search_ptr = cache_ptr->pel_head_ptr;
+
+ while ( ( search_ptr != NULL ) &&
+ ( search_ptr !=
+ (struct H5C_cache_entry_t *)entry_ptr ) )
+ {
+ search_ptr = search_ptr->next;
+ }
+
+ if ( search_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 7.";
+ }
+ }
+ }
+
+ if ( pass ) {
+
+ /* Verify that unpinned entries are in the LRU list */
+ if ( ! ((entry_ptr->header).is_pinned) ) {
+
+ search_ptr = cache_ptr->LRU_head_ptr;
+
+ while ( ( search_ptr != NULL ) &&
+ ( search_ptr !=
+ (struct H5C_cache_entry_t *)entry_ptr ) )
+ {
+ search_ptr = search_ptr->next;
+ }
+
+ if ( search_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 8.";
+ }
+ }
+ }
+
+#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
+ if ( pass ) {
+
+ /* Verify that unpinned entries are in the dirty LRU list */
+ if ( ! ((entry_ptr->header).is_pinned) ) {
+
+ search_ptr = cache_ptr->dLRU_head_ptr;
+
+ while ( ( search_ptr != NULL ) &&
+ ( search_ptr !=
+ (struct H5C_cache_entry_t *)entry_ptr ) )
+ {
+ search_ptr = search_ptr->aux_next;
+ }
+
+ if ( search_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 9.";
+ }
+ }
+ }
+#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
+ i++;
+
+ } /* while */
+
+
+ /* So much for looking at the individual entries. Now verify
+ * that the various counts and sized in the cache header are
+ * as expected.
+ */
+
+ if ( pass ) {
+
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size != 4 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->slist_len != 4 ) ||
+ ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->pl_len != 0 ) ||
+ ( cache_ptr->pl_size != (size_t)0 ) ||
+ ( cache_ptr->pel_len != 2 ) ||
+ ( cache_ptr->pel_size != 2 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->LRU_list_len != 2 ) ||
+ ( cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type] ) ||
+#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
+ ( cache_ptr->dLRU_list_len != 2 ) ||
+ ( cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type] ) ||
+#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+ ( cache_ptr->cLRU_list_len != 0 ) ||
+ ( cache_ptr->cLRU_list_size != (size_t)0 ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 10.";
+ }
+ }
+
+
+ /* Finally, if stats collection is enabled, verify that the expected
+ * stats are collected.
+ */
+#if H5C_COLLECT_CACHE_STATS
+ if ( pass ) {
+
+ if ( ( cache_ptr->insertions[entry_type] != 4 ) ||
+ ( cache_ptr->pinned_insertions[entry_type] != 2 ) ||
+ ( cache_ptr->pins[entry_type] != 2 ) ||
+ ( cache_ptr->unpins[entry_type] != 0 ) ||
+ ( cache_ptr->dirty_pins[entry_type] != 0 ) ||
+ ( cache_ptr->max_index_len != 4 ) ||
+ ( cache_ptr->max_index_size != 4 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->max_slist_len != 4 ) ||
+ ( cache_ptr->max_slist_size != 4 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->max_pl_len != 0 ) ||
+ ( cache_ptr->max_pl_size != (size_t)0 ) ||
+ ( cache_ptr->max_pel_len != 2 ) ||
+ ( cache_ptr->max_pel_size != 2 * entry_sizes[entry_type] ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 11.";
+ }
+ }
+#endif /* H5C_COLLECT_CACHE_STATS */
+
+
+ /* Unpin the pinned entries so we can take down the cache cleanly. */
+
+ if ( pass ) {
+
+ unpin_entry(cache_ptr, entry_type, 2);
+ unpin_entry(cache_ptr, entry_type, 3);
+ }
+
+ if ( pass ) {
+
+ takedown_cache(cache_ptr, FALSE, FALSE);
+ }
+
+ if ( pass ) { PASSED(); } else { H5_FAILED(); }
+
+ if ( ! pass ) {
+
+ HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
+ fcn_name, failure_mssg);
+ }
+
+ return;
+
+} /* check_insert_entry() */
+
+
+/*-------------------------------------------------------------------------
* Function: check_flush_cache()
*
* Purpose: Verify that flush_cache behaves as expected. In particular,
@@ -5690,6 +5993,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
);
}
+
/* Now run single entry tests for pinned entries. Test all combinations
* of:
*
@@ -18448,6 +18752,7 @@ main(void)
#endif
#if 1
write_permitted_check();
+ check_insert_entry();
check_flush_cache();
check_get_entry_status();
check_expunge_entry();
diff --git a/test/cache_common.c b/test/cache_common.c