~ubuntu-branches/ubuntu/feisty/ncbi-tools6/feisty

« back to all changes in this revision

Viewing changes to connect/test/test_ncbi_disp.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Id: test_ncbi_disp.c,v 6.18 2005/07/11 18:49:15 lavr Exp $
 
1
/*  $Id: test_ncbi_disp.c,v 6.23 2006/04/05 15:07:09 lavr Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
33
33
#include "../ncbi_priv.h"               /* CORE logging facilities */
34
34
#include "../ncbi_servicep.h"
35
35
#include <stdlib.h>
 
36
#include <string.h>
36
37
/* This header must go last */
37
38
#include "test_assert.h"
38
39
 
43
44
int main(int argc, const char* argv[])
44
45
{
45
46
    const char* service = argc > 1 ? argv[1] : "bounce";
46
 
    int/*bool*/ local = argc > 2;
 
47
    SConnNetInfo* net_info;
47
48
    const SSERV_Info* info;
48
49
    int n_found = 0;
49
50
    SERV_ITER iter;
52
53
                           fLOG_OmitNoteLevel | fLOG_DateTime);
53
54
    CORE_SetLOGFILE(stderr, 0/*false*/);
54
55
 
55
 
    CORE_LOGF(eLOG_Note, ("Looking for service `%s' (%s)", service,
56
 
                          local ? "locally" : "randomly"));
 
56
    CORE_LOGF(eLOG_Note, ("Looking for service `%s'", service));
 
57
    net_info = ConnNetInfo_Create(service);
57
58
    CORE_LOG(eLOG_Trace, "Opening service mapper");
58
 
    if ((local &&
59
 
         (iter = SERV_OpenP(service, fSERV_Any, SERV_LOCALHOST, 0.0,
60
 
                            0, 0/*net_info*/, 0, 0)) != 0) ||
61
 
        (!local && (iter = SERV_OpenSimple(service)) != 0)) {
 
59
    iter = SERV_OpenP(service, (fSERV_All & ~fSERV_Firewall) |
 
60
                      (strpbrk(service, "?*") ? fSERV_Promiscuous : 0),
 
61
                      SERV_LOCALHOST, 0/*port*/, 0.0/*preference*/,
 
62
                      net_info, 0/*skip*/, 0/*n_skip*/,
 
63
                      0/*external*/, 0/*arg*/, 0/*val*/);
 
64
    ConnNetInfo_Destroy(net_info);
 
65
    if (iter) {
62
66
        HOST_INFO hinfo;
63
 
        CORE_LOG(eLOG_Trace, "Service mapper has been successfully opened");
 
67
        CORE_LOGF(eLOG_Trace,("%s service mapper has been successfully opened",
 
68
                              SERV_MapperName(iter)));
64
69
        while ((info = SERV_GetNextInfoEx(iter, &hinfo)) != 0) {
65
70
            char* info_str = SERV_WriteInfo(info);
66
71
            CORE_LOGF(eLOG_Note, ("Service `%s' = %s",
68
73
            if (hinfo) {
69
74
                double array[2];
70
75
                const char* e = HINFO_Environment(hinfo);
 
76
                const char* a = HINFO_AffinityArgument(hinfo);
 
77
                const char* v = HINFO_AffinityArgvalue(hinfo);
71
78
                CORE_LOG(eLOG_Note, "  Host info available:");
72
79
                CORE_LOGF(eLOG_Note, ("    Number of CPUs: %d",
73
80
                                      HINFO_CpuCount(hinfo)));
78
85
                                          array[0], array[1]));
79
86
                } else
80
87
                    CORE_LOG (eLOG_Note,  "    Load average: unavailable");
 
88
                if (a) {
 
89
                    assert(*a);
 
90
                    CORE_LOGF(eLOG_Note, ("    Affinity argument: %s", a));
 
91
                }
 
92
                if (a  &&  v)
 
93
                    CORE_LOGF(eLOG_Note, ("    Affinity value:    %s%s%s",
 
94
                                          *v ? "" : "\"", v, *v ? "" : "\""));
81
95
                CORE_LOGF(eLOG_Note, ("    Host environment: %s%s%s",
82
96
                                      e? "\"": "", e? e: "NULL", e? "\"": ""));
83
97
                free(hinfo);
126
140
/*
127
141
 * --------------------------------------------------------------------------
128
142
 * $Log: test_ncbi_disp.c,v $
 
143
 * Revision 6.23  2006/04/05 15:07:09  lavr
 
144
 * Print mapper name first
 
145
 *
 
146
 * Revision 6.22  2006/03/05 17:43:01  lavr
 
147
 * Log service mapper name; extract affinities (if any)
 
148
 *
 
149
 * Revision 6.21  2006/01/11 16:35:59  lavr
 
150
 * Open service iterator for everything (but FIREWALL)
 
151
 *
 
152
 * Revision 6.20  2005/12/23 18:20:33  lavr
 
153
 * Use new SERV_OpenP() for iterator opening (and thus allow service wildcards)
 
154
 *
 
155
 * Revision 6.19  2005/12/14 21:45:39  lavr
 
156
 * Adjust to use new SERV_OpenP() prototype
 
157
 *
129
158
 * Revision 6.18  2005/07/11 18:49:15  lavr
130
159
 * Hashed preference generation algorithm retired (proven to fail often)
131
160
 *