本文整理汇总了C++中debug4函数的典型用法代码示例。如果您正苦于以下问题:C++ debug4函数的具体用法?C++ debug4怎么用?C++ debug4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug4函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: adler_lookup_table_test
//Our table may have false positives, but never false negatives
//I.E. For items which ARE in the table, it is ALWAYS correct. (Returns true)
//For items which ARE NOT in the table, it is USUALLY correct. (Returns false, but collisions can return true)
void adler_lookup_table_test(int data_count, int data_offset, int bit_table_width, const char *data, int data_len) {
debug4("%d %d\n", data_count, bit_table_width);
struct adler32table testTable;
struct adler32 adler;
short *shorts = (short*) data;
int i;
assert(data_len >= ((4*data_count)+data_offset)); //4 bytes for a 'fake' adler32 instance
adler_table_init(&testTable, bit_table_width);
for (i=data_offset; i < data_count; i++) {
adler.aVal = shorts[2*i];
adler.bVal = shorts[2*i + 1];
adler_table_update(&testTable, &adler);
}
for (i=data_offset; i < data_count; i++) {
adler.aVal = shorts[2*i];
adler.bVal = shorts[(2*i)+1];
debug4("Vals: %d %d\n", shorts[2*i], shorts[2*i + 1]);
assert(adler_table_present(&testTable, &adler));
}
adler_table_free(&testTable);
}
开发者ID:ZachAnders,项目名称:RedunDuplicator,代码行数:26,代码来源:lookup_table_test.c
示例2: init
/*
* init() is called when the plugin is loaded, before any other functions
* are called. Put global initialization here.
*/
extern int init ( void )
{
static int first = 1;
if(first) {
/* since this can be loaded from many different places
only tell us once. */
verbose("%s loaded", plugin_name);
first = 0;
} else {
debug4("%s loaded", plugin_name);
}
return SLURM_SUCCESS;
}
开发者ID:VURM,项目名称:slurm,代码行数:19,代码来源:jobcomp_mysql.c
示例3: conf_proxy_reset_settings_cb
static void
conf_proxy_reset_settings_cb (GSettings *settings,
guint cnxn_id,
gchar *key,
gpointer user_data)
{
gchar *proxyname, *proxyusername, *proxypassword;
gint proxyport;
gint proxydetectmode;
gboolean proxyuseauth;
proxyname = NULL;
proxyport = 0;
proxyusername = NULL;
proxypassword = NULL;
conf_get_int_value (PROXY_DETECT_MODE, &proxydetectmode);
switch (proxydetectmode) {
default:
case 0:
debug0 (DEBUG_CONF, "proxy auto detect is configured");
/* nothing to do, all done by libproxy inside libsoup */
break;
case 1:
debug0 (DEBUG_CONF, "proxy is disabled by user");
/* nothing to do */
break;
case 2:
debug0 (DEBUG_CONF, "manual proxy is configured");
conf_get_str_value (PROXY_HOST, &proxyname);
conf_get_int_value (PROXY_PORT, &proxyport);
conf_get_bool_value (PROXY_USEAUTH, &proxyuseauth);
if (proxyuseauth) {
conf_get_str_value (PROXY_USER, &proxyusername);
conf_get_str_value (PROXY_PASSWD, &proxypassword);
}
break;
}
debug4 (DEBUG_CONF, "Manual proxy settings are now %s:%d %s:%s", proxyname != NULL ? proxyname : "NULL", proxyport,
proxyusername != NULL ? proxyusername : "NULL",
proxypassword != NULL ? proxypassword : "NULL");
network_set_proxy (proxydetectmode, proxyname, proxyport, proxyusername, proxypassword);
}
开发者ID:gcampax,项目名称:liferea,代码行数:45,代码来源:conf.c
示例4: DeleteEverySym
void DeleteEverySym(void)
{ int i, j, load, cost; OBJECT p, plink, link, x, entry;
debug0(DST, DD, "DeleteEverySym()");
/* dispose the bodies of all symbols */
for( i = 0; i < MAX_TAB; i++ )
{ entry = (OBJECT) &symtab[i];
for( plink = Down(entry); plink != entry; plink = NextDown(plink) )
{ Child(p, plink);
for( link = Down(p); link != p; link = NextDown(link) )
{ Child(x, link); DeleteSymBody(x);
/* *** will not work now
while( base_uses(x) != nilobj )
{ tmp = base_uses(x); base_uses(x) = next(tmp);
PutMem(tmp, USES_SIZE);
}
while( uses(x) != nilobj )
{ tmp = uses(x); uses(x) = next(tmp);
PutMem(tmp, USES_SIZE);
}
*** */
}
}
}
/* dispose the symbol name strings, gather statistics, and print them */
load = cost = 0;
for( i = 0; i < MAX_TAB; i++ )
{ j = 1; entry = (OBJECT) &symtab[i];
while( Down(entry) != entry )
{ load += 1; cost += j; j += 1;
DisposeChild(Down(entry));
}
}
if( load > 0 )
{ debug4(DST, DD, "size = %d, items = %d (%d%%), probes = %.1f",
MAX_TAB, load, (100*load)/MAX_TAB, (float) cost/load);
}
else
{ debug1(DST, DD, "table size = %d, no entries in table", MAX_TAB);
}
debug0(DST, DD, "DeleteEverySym returning.");
} /* end DeleteEverySym */
开发者ID:thektulu,项目名称:lout,代码行数:43,代码来源:z29.c
示例5: scan_info
void scan_info(const char* filename)
{
struct stat statbuf;
char infoname[100];
time_t expiry;
int fd;
unsigned i;
strcpy(infoname, "info/");
strcpy(infoname+5, filename);
if((fd = open(infoname, O_RDONLY)) == -1 ||
fstat(fd, &statbuf) == -1) {
/* This could race with qmail-clean, ignore missing files. */
if (errno == ENOENT)
return;
die3sys(111, "Can't open or stat info file '", infoname, "'");
}
/* Handle the file only if it's expiry time (creation time + opt_age)
is before now and after the last run */
for (i = 0; i < opt_age_count; ++i) {
expiry = statbuf.st_mtime + opt_ages[i];
debug4(1, "filename=", filename, " expiry=", utoa(expiry));
if(expiry > now)
debug1(1, "ignoring, has not yet expired");
else if(expiry <= lastrun) {
debug1(1, "ignoring, was previously expired");
break;
}
else {
/* Load the sender address from the info file */
char* sender = malloc(statbuf.st_size);
if (read(fd, sender, statbuf.st_size) != statbuf.st_size)
die3sys(111, "Reading from info file '", infoname, "' failed");
if(check_rcpt(sender+1))
make_bounce(sender+1, filename, opt_ages[i]);
else
debug2(1, "ignoring, sender was not in rcpthosts: ", sender+1);
free(sender);
break;
}
}
close(fd);
}
开发者ID:bruceg,项目名称:qmail-notify,代码行数:42,代码来源:qmail-notify.c
示例6: main
int main(int argc, char **argv) {
gf_t *gfield_context = malloc(sizeof(gf_t));
uint32_t *vmond_row = malloc(NUM_CHECKSUMS*sizeof(uint32_t));
uint32_t *chksums = calloc(NUM_CHECKSUMS, sizeof(uint32_t));
uint32_t data = 0x41414141;
debug4("Initializing gf.\n");
gf_init_easy(gfield_context, FIELD_SIZE);
for (int i = 0; i < 32; i++) {
printarray(chksums, NUM_CHECKSUMS);
createvmond(gfield_context, vmond_row, NUM_CHECKSUMS, i+1);
updatechecksum(gfield_context, chksums, vmond_row, NUM_CHECKSUMS, data);
//stepvmond(gfield_context, vmond_matrix, FIELD_SIZE);
}
printarray(chksums, NUM_CHECKSUMS);
//free(gfield_context);
argc=0; argv=0;
}
开发者ID:ZachAnders,项目名称:RedunDuplicator,代码行数:20,代码来源:vmondmatrix_test.c
示例7: as_mysql_node_up
extern int as_mysql_node_up(mysql_conn_t *mysql_conn,
struct node_record *node_ptr,
time_t event_time)
{
char* query;
int rc = SLURM_SUCCESS;
if (check_connection(mysql_conn) != SLURM_SUCCESS)
return ESLURM_DB_CONNECTION;
query = xstrdup_printf(
"update \"%s_%s\" set time_end=%ld where "
"time_end=0 and node_name='%s';",
mysql_conn->cluster_name, event_table,
event_time, node_ptr->name);
debug4("%d(%s:%d) query\n%s",
mysql_conn->conn, THIS_FILE, __LINE__, query);
rc = mysql_db_query(mysql_conn, query);
xfree(query);
return rc;
}
开发者ID:CornellCAC,项目名称:slurm,代码行数:21,代码来源:as_mysql_cluster.c
示例8: network_set_proxy
void
network_set_proxy (ProxyDetectMode mode, gchar *host, guint port, gchar *user, gchar *password)
{
g_free (proxyname);
g_free (proxyusername);
g_free (proxypassword);
proxymode = mode;
proxyname = host;
proxyport = port;
proxyusername = user;
proxypassword = password;
/* session will be NULL if we were called from conf_init() as that's called
* before net_init() */
if (session)
network_set_soup_session_proxy (session, mode, host, port, user, password);
debug4 (DEBUG_NET, "proxy set to http://%s:%[email protected]%s:%d", user, password, host, port);
network_monitor_proxy_changed ();
}
开发者ID:gcampax,项目名称:liferea,代码行数:21,代码来源:net.c
示例9: SetNeighbours
void SetNeighbours(OBJECT link, BOOLEAN ratm, OBJECT *pg, OBJECT *pdef,
OBJECT *sg, OBJECT *sdef, int *side)
{ OBJECT plink, slink;
/* find preceding definite; if it exists, set *pg */
*pg = nilobj;
for( plink = PrevDown(link); type(plink) == LINK; plink = PrevDown(plink) )
{ Child(*pdef, plink);
if( type(*pdef) == SPLIT ? SplitIsDefinite(*pdef) : is_definite(type(*pdef)) )
{ Child(*pg, PrevDown(link));
while( is_index(type(*pg)) )
{ link = PrevDown(link);
Child(*pg, PrevDown(link));
}
assert( type(*pg) == GAP_OBJ, "SetNeighbours: type(*pg)!" );
break;
}
}
/* find succeeding definite; if it exists, set *sg */
*sg = nilobj;
for( slink = NextDown(link); type(slink) == LINK; slink = NextDown(slink) )
{ Child(*sdef, slink);
if( type(*sdef) == SPLIT ? SplitIsDefinite(*sdef) : is_definite(type(*sdef)) )
{ Child(*sg, PrevDown(slink));
while( is_index(type(*sg)) )
{ slink = PrevDown(slink);
Child(*sg, PrevDown(slink));
}
assert( type(*sg) == GAP_OBJ, "SetNeighbours: type(*sg)!" );
break;
}
}
*side = ratm ? BACK : *pg == nilobj || mark(gap(*pg)) ? ON : FWD;
debug4(DSA, DD,
"SetNeighbours: ratm == %s, pg %s nilobj, sg %s nilobj, side == %s",
bool(ratm), *pg == nilobj ? "==" : "!=", *sg == nilobj ? "==" : "!=",
*side == BACK ? "BACK" : *side == ON ? "ON" : "FWD");
} /* end SetNeighbours */
开发者ID:thektulu,项目名称:lout,代码行数:40,代码来源:z16.c
示例10: _log_lua_msg
/*
* Lua interface to SLURM log facility:
*/
static int _log_lua_msg (lua_State *L)
{
const char *prefix = "job_submit.lua";
int level = 0;
const char *msg;
/*
* Optional numeric prefix indicating the log level
* of the message.
*/
/*
* Pop message off the lua stack
*/
msg = lua_tostring(L, -1);
lua_pop (L, 1);
/*
* Pop level off stack:
*/
level = (int)lua_tonumber (L, -1);
lua_pop (L, 1);
/*
* Call appropriate slurm log function based on log-level argument
*/
if (level > 4)
debug4 ("%s: %s", prefix, msg);
else if (level == 4)
debug3 ("%s: %s", prefix, msg);
else if (level == 3)
debug2 ("%s: %s", prefix, msg);
else if (level == 2)
debug ("%s: %s", prefix, msg);
else if (level == 1)
verbose ("%s: %s", prefix, msg);
else if (level == 0)
info ("%s: %s", prefix, msg);
return (0);
}
开发者ID:jsollom,项目名称:slurm,代码行数:42,代码来源:job_submit_lua.c
示例11: FindShift
FULL_LENGTH FindShift(OBJECT x, OBJECT y, int dim)
{ FULL_LENGTH len = 0, res = 0; /* initial values unused */
debug4(DSF, DD, "FindShift(%s, %s %s, %s)", Image(type(x)),
Image(type(y)), EchoObject(y), dimen(dim));
/* first determine the magnitude of the shift */
switch( units(shift_gap(x)) )
{
case FIXED_UNIT: len = width(shift_gap(x));
break;
case NEXT_UNIT: len = (size(y, dim) * width(shift_gap(x))) / FR;
break;
default: assert(FALSE, "FindShift: units");
break;
}
/* then calculate the shift depending on the shift type */
switch( shift_type(x) )
{
case GAP_ABS: res = len - back(y, dim);
break;
case GAP_INC: res = len;
break;
case GAP_DEC: res = - len;
break;
default: assert(FALSE, "FindShift: type");
break;
}
debug1(DSF, DD, "FindShift returning %s", EchoLength(res));
return res;
} /* end FindShift */
开发者ID:thektulu,项目名称:lout,代码行数:37,代码来源:z16.c
示例12: _mysql_query_internal
/* NOTE: Insure that mysql_conn->lock is set on function entry */
static int _mysql_query_internal(MYSQL *db_conn, char *query)
{
int rc = SLURM_SUCCESS;
if (!db_conn)
fatal("You haven't inited this storage yet.");
/* clear out the old results so we don't get a 2014 error */
_clear_results(db_conn);
if (mysql_query(db_conn, query)) {
const char *err_str = mysql_error(db_conn);
errno = mysql_errno(db_conn);
if (errno == ER_NO_SUCH_TABLE) {
debug4("This could happen often and is expected.\n"
"mysql_query failed: %d %s\n%s",
errno, err_str, query);
errno = 0;
goto end_it;
}
error("mysql_query failed: %d %s\n%s", errno, err_str, query);
if (errno == ER_LOCK_WAIT_TIMEOUT) {
fatal("mysql gave ER_LOCK_WAIT_TIMEOUT as an error. "
"The only way to fix this is restart the "
"calling program");
}
/* FIXME: If we get ER_LOCK_WAIT_TIMEOUT here we need
* to restart the connections, but it appears restarting
* the calling program is the only way to handle this.
* If anyone in the future figures out a way to handle
* this, super. Until then we will need to restart the
* calling program if you ever get this error.
*/
rc = SLURM_ERROR;
}
end_it:
return rc;
}
开发者ID:bingzhang,项目名称:slurm,代码行数:38,代码来源:mysql_common.c
示例13: _process_job_usage
/* process job usage data */
static int
_process_job_usage(pgsql_conn_t *pg_conn, char *cluster, time_t start,
time_t end, List cu_list, List ru_list, List au_list,
List wu_list)
{
DEF_VARS;
PGresult *result2;
ListIterator r_itr;
int seconds = 0, last_id = -1, last_wckeyid = -1;
local_cluster_usage_t *c_usage = NULL;
local_resv_usage_t *r_usage = NULL;
local_id_usage_t *a_usage = NULL, *w_usage = NULL;
int track_wckey = slurm_get_track_wckey();
char *gj_fields = "job_db_inx,id_job,id_assoc,id_wckey,time_eligible,"
"time_start,time_end,time_suspended,cpus_alloc,cpus_req,"
"id_resv";
enum {
F_DB_INX,
F_JOBID,
F_ASSOCID,
F_WCKEYID,
F_ELG,
F_START,
F_END,
F_SUSPENDED,
F_ACPU,
F_RCPU,
F_RESVID,
F_COUNT
};
query = xstrdup_printf(
"SELECT %s FROM %s.%s WHERE (time_eligible < %ld AND "
"(time_end >= %ld OR time_end = 0)) ORDER BY id_assoc, "
"time_eligible", gj_fields, cluster, job_table,
(long)end, (long)start);
result = DEF_QUERY_RET;
if (!result) {
error("failed to get jobs");
return SLURM_ERROR;
}
r_itr = list_iterator_create(ru_list);
FOR_EACH_ROW {
int job_id = atoi(ROW(F_JOBID));
int assoc_id = atoi(ROW(F_ASSOCID));
int wckey_id = atoi(ROW(F_WCKEYID));
int resv_id = atoi(ROW(F_RESVID));
int row_eligible = atoi(ROW(F_ELG));
int row_start = atoi(ROW(F_START));
int row_end = atoi(ROW(F_END));
int row_acpu = atoi(ROW(F_ACPU));
int row_rcpu = atoi(ROW(F_RCPU));
seconds = 0;
if (row_start && (row_start < start))
row_start = start;
if (!row_start && row_end)
row_start = row_end;
if (!row_end || row_end > end)
row_end = end;
if (!row_start || ((row_end - row_start) < 1))
goto calc_cluster;
seconds = (row_end - row_start);
if (strcmp(ROW(F_SUSPENDED), "0")) {
query = xstrdup_printf(
"SELECT %s.get_job_suspend_time(%s, %ld, %ld);",
cluster, ROW(F_DB_INX), start, end);
result2 = DEF_QUERY_RET;
if (!result2) {
list_iterator_destroy(r_itr);
return SLURM_ERROR;
}
seconds -= atoi(PQgetvalue(result2, 0, 0));
PQclear(result2);
}
if (seconds < 1) {
debug4("This job (%u) was suspended "
"the entire hour", job_id);
/* TODO: how about resv usage? */
continue;
}
if (last_id != assoc_id) { /* ORDER BY associd */
a_usage = xmalloc(sizeof(local_id_usage_t));
a_usage->id = assoc_id;
list_append(au_list, a_usage);
last_id = assoc_id;
}
a_usage->a_cpu += seconds * row_acpu;
if (!track_wckey)
goto calc_cluster;
/* do the wckey calculation */
if (last_wckeyid != wckey_id) {
//.........这里部分代码省略.........
开发者ID:IFCA,项目名称:slurm,代码行数:101,代码来源:as_pg_rollup.c
示例14: as_mysql_get_txn
//.........这里部分代码省略.........
/* make sure we can get the max length out of the database
* when grouping the names
*/
if (txn_cond->with_assoc_info)
mysql_db_query(mysql_conn,
"set session group_concat_max_len=65536;");
empty:
if (!locked && (use_cluster_list == as_mysql_cluster_list)) {
slurm_mutex_lock(&as_mysql_cluster_list_lock);
locked = 1;
}
xfree(tmp);
xstrfmtcat(tmp, "%s", txn_req_inx[i]);
for(i=1; i<TXN_REQ_COUNT; i++) {
xstrfmtcat(tmp, ", %s", txn_req_inx[i]);
}
query = xstrdup_printf("select %s from %s", tmp, txn_table);
if (extra) {
xstrfmtcat(query, "%s", extra);
xfree(extra);
}
xstrcat(query, " order by timestamp;");
xfree(tmp);
if (debug_flags & DEBUG_FLAG_DB_QUERY)
DB_DEBUG(mysql_conn->conn, "query\n%s", query);
if (!(result = mysql_db_query_ret(
mysql_conn, query, 0))) {
xfree(query);
goto end_it;
}
xfree(query);
txn_list = list_create(slurmdb_destroy_txn_rec);
while ((row = mysql_fetch_row(result))) {
slurmdb_txn_rec_t *txn = xmalloc(sizeof(slurmdb_txn_rec_t));
list_append(txn_list, txn);
txn->action = slurm_atoul(row[TXN_REQ_ACTION]);
txn->actor_name = xstrdup(row[TXN_REQ_ACTOR]);
txn->id = slurm_atoul(row[TXN_REQ_ID]);
txn->set_info = xstrdup(row[TXN_REQ_INFO]);
txn->timestamp = slurm_atoul(row[TXN_REQ_TS]);
txn->where_query = xstrdup(row[TXN_REQ_NAME]);
txn->clusters = xstrdup(row[TXN_REQ_CLUSTER]);
if (txn_cond && txn_cond->with_assoc_info
&& (txn->action == DBD_ADD_ASSOCS
|| txn->action == DBD_MODIFY_ASSOCS
|| txn->action == DBD_REMOVE_ASSOCS)) {
MYSQL_RES *result2 = NULL;
MYSQL_ROW row2;
if (txn->clusters) {
query = xstrdup_printf(
"select "
"group_concat(distinct user "
"order by user), "
"group_concat(distinct acct "
"order by acct) "
"from \"%s_%s\" where %s",
txn->clusters, assoc_table,
row[TXN_REQ_NAME]);
debug4("%d(%s:%d) query\n%s", mysql_conn->conn,
THIS_FILE, __LINE__, query);
if (!(result2 = mysql_db_query_ret(
mysql_conn, query, 0))) {
xfree(query);
continue;
}
xfree(query);
if ((row2 = mysql_fetch_row(result2))) {
if (row2[0] && row2[0][0])
txn->users = xstrdup(row2[0]);
if (row2[1] && row2[1][0])
txn->accts = xstrdup(row2[1]);
}
mysql_free_result(result2);
} else {
error("We can't handle associations "
"from action %s yet.",
slurmdbd_msg_type_2_str(txn->action, 1));
}
}
}
mysql_free_result(result);
end_it:
if (locked)
slurm_mutex_unlock(&as_mysql_cluster_list_lock);
return txn_list;
}
开发者ID:A1ve5,项目名称:slurm,代码行数:101,代码来源:as_mysql_txn.c
示例15: rd_ioctl
static int rd_ioctl(register struct inode *inode, struct file *file,
unsigned int cmd, unsigned int arg)
{
unsigned long size;
unsigned int i;
int j, k, target = DEVICE_NR(inode->i_rdev);
if (!suser())
return -EPERM;
debug2("RD: ioctl %d %s\n", target, (cmd ? "kill" : "make"));
switch (cmd) {
case RDCREATE:
if (rd_info[target].flags && RD_BUSY) {
return -EBUSY;
} else {
/* allocate memory */
#if 0
rd_info[target].size = 0;
#endif
k = -1;
for (i = 0; i <= (arg - 1) / ((SEG_SIZE / 1024) * P_SIZE); i++) {
j = find_free_seg(); /* find free place in queue */
debug1("RD: ioctl find_free_seg() = %d\n", j);
if (j == -1) {
rd_dealloc(target);
return -ENOMEM;
}
if (i == 0)
rd_info[target].index = j;
if (i == (arg / ((SEG_SIZE / 1024) * P_SIZE)))
/* size in 16 byte pagez = (arg % 64) * 64 */
size =
(arg % ((SEG_SIZE / 1024) * P_SIZE)) *
((SEG_SIZE / 1024) * P_SIZE);
else
size = SEG_SIZE;
rd_segment[j].segment = mm_alloc(size);
if (rd_segment[j].segment == -1) {
rd_dealloc(target);
return -ENOMEM;
}
debug4("RD: ioctl pass: %d, allocated %d pages, rd_segment[%d].segment = 0x%x\n",
i, (int) size, j, rd_segment[j].segment);
/* recalculate int size to reflect size in sectors, not pages */
size = size / DIVISOR;
rd_segment[j].seg_size = size; /* size in sectors */
debug2("RD: ioctl rd_segment[%d].seg_size = %d sectors\n",
j, rd_segment[j].seg_size);
rd_info[target].size += rd_segment[j].seg_size; /* size in 512 B blocks */
size = (long) rd_segment[j].seg_size * SECTOR_SIZE;
debug1("RD: ioctl size = %ld\n", size);
/* this terrible hack makes sure fmemset clears whole segment even if size == 64 KB :) */
if (size != ((long) SEG_SIZE * (long) P_SIZE)) {
debug2("RD: ioctl calling fmemset(0, 0x%x, 0, %d) ..\n",
rd_segment[j].segment, (int) size);
fmemset(0, rd_segment[j].segment, 0, (int) size); /* clear seg_size * SECTOR_SIZE bytes */
} else {
debug2("RD: ioctl calling fmemset(0, 0x%x, 0, %d) ..\n",
rd_segment[j].segment, (int) (size / 2));
fmemset(0, rd_segment[j].segment, 0, (int) (size / 2)); /* we could hardcode 32768 instead of size / 2 here */
debug3("rd_ioctl(): calling fmemset(%d, 0x%x, 0, %d) ..\n",
(int) (size / 2), rd_segment[j].segment,
(int) (size / 2));
fmemset((size / 2), rd_segment[j].segment, 0,
(int) (size / 2));
}
if (k != -1)
rd_segment[k].next = j; /* set link to next index */
k = j;
}
rd_info[target].flags = RD_BUSY;
debug3("RD: ioctl ramdisk %d created, size = %d blocks, index = %d\n",
target, rd_info[target].size, rd_info[target].index);
}
debug("RD: ioctl about to return 0\n");
return 0;
case RDDESTROY:
if (rd_info[target].flags && RD_BUSY) {
invalidate_inodes(inode->i_rdev);
invalidate_buffers(inode->i_rdev);
rd_dealloc(target);
rd_info[target].flags = 0;
return 0;
} else
return -EINVAL;
}
return -EINVAL;
}
开发者ID:KP1533TM2,项目名称:elks,代码行数:96,代码来源:rd.c
示例16: _cluster_get_jobs
//.........这里部分代码省略.........
job_ended = 1;
if (!job->start || (job->start > job->end))
job->start = job->end;
}
if (job_cond && !job_cond->without_usage_truncation
&& job_cond->usage_start) {
if (job->start && (job->start < job_cond->usage_start))
job->start = job_cond->usage_start;
if (!job->end || job->end > job_cond->usage_end)
job->end = job_cond->usage_end;
if (!job->start)
job->start = job->end;
job->elapsed = job->end - job->start;
if (row[JOB_REQ_SUSPENDED]) {
MYSQL_RES *result2 = NULL;
MYSQL_ROW row2;
/* get the suspended time for this job */
query = xstrdup_printf(
"select time_start, time_end from "
"\"%s_%s\" where "
"(time_start < %ld && (time_end >= %ld "
"|| time_end = 0)) && job_db_inx=%s "
"order by time_start",
cluster_name, suspend_table,
job_cond->usage_end,
job_cond->usage_start,
id);
debug4("%d(%s:%d) query\n%s",
mysql_conn->conn, THIS_FILE,
__LINE__, query);
if (!(result2 = mysql_db_query_ret(
mysql_conn,
query, 0))) {
FREE_NULL_LIST(job_list);
job_list = NULL;
break;
}
xfree(query);
while ((row2 = mysql_fetch_row(result2))) {
time_t local_start =
slurm_atoul(row2[0]);
time_t local_end =
slurm_atoul(row2[1]);
if (!local_start)
continue;
if (job->start > local_start)
local_start = job->start;
if (job->end < local_end)
local_end = job->end;
if ((local_end - local_start) < 1)
continue;
job->elapsed -=
(local_end - local_start);
job->suspended +=
(local_end - local_start);
}
开发者ID:jwhite530,项目名称:slurm,代码行数:67,代码来源:as_mysql_jobacct_process.c
示例17: plugin_load_and_link
plugin_handle_t
plugin_load_and_link(const char *type_name, int n_syms,
const char *names[], void *ptrs[])
{
plugin_handle_t plug = PLUGIN_INVALID_HANDLE;
struct stat st;
char *head = NULL, *dir_array = NULL, *so_name = NULL;
char *file_name = NULL;
int i = 0;
plugin_err_t err = EPLUGIN_NOTFOUND;
if (!type_name)
return plug;
so_name = xstrdup_printf("%s.so", type_name);
while (so_name[i]) {
if (so_name[i] == '/')
so_name[i] = '_';
i++;
}
if (!(dir_array = slurm_get_plugin_dir())) {
error("plugin_load_and_link: No plugin dir given");
xfree(so_name);
return plug;
}
head = dir_array;
for (i = 0; ; i++) {
bool got_colon = 0;
if (dir_array[i] == ':') {
dir_array[i] = '\0';
got_colon = 1;
} else if (dir_array[i] != '\0')
continue;
file_name = xstrdup_printf("%s/%s", head, so_name);
debug3("Trying to load plugin %s", file_name);
if ((stat(file_name, &st) < 0) || (!S_ISREG(st.st_mode))) {
debug4("%s: Does not exist or not a regular file.",
file_name);
xfree(file_name);
err = EPLUGIN_NOTFOUND;
} else {
if ((err = plugin_load_from_file(&plug, file_name))
== EPLUGIN_SUCCESS) {
if (plugin_get_syms(plug, n_syms,
names, ptrs) >= n_syms) {
debug3("Success.");
xfree(file_name);
break;
} else {
(void) dlclose(plug);
err = EPLUGIN_MISSING_SYMBOL;
plug = PLUGIN_INVALID_HANDLE;
}
} else
plug = PLUGIN_INVALID_HANDLE;
xfree(file_name);
}
if (got_colon) {
head = dir_array + i + 1;
} else
break;
}
xfree(dir_array);
xfree(so_name);
errno = err;
return plug;
}
开发者ID:chrisdukey,项目名称:slurm,代码行数:70,代码来源:plugin.c
示例18: AttachGalley
//.........这里部分代码省略.........
enclose_obj(target_galley) = limiter(target_galley) = nilobj;
ClearHeaders(target_galley);
opt_components(target_galley) = opt_constraints(target_galley) = nilobj;
gall_dir(target_galley) = external_hor(target) ? COLM : ROWM;
FposCopy(fpos(target_galley), fpos(target));
actual(target_galley) = actual(target);
whereto(target_galley) = ready_galls(target_galley) = nilobj;
foll_or_prec(target_galley) = GALL_FOLL;
must_expand(target_galley) = FALSE;
sized(target_galley) = FALSE;
/* get perpendicular constraint (none if horizontal galley) */
if( dim == ROWM )
{
Constrained(target, &c, 1-dim, &junk);
if( !constrained(c) )
Error(19, 2, "receptive symbol %s has unconstrained width",
FATAL, &fpos(target), SymName(actual(target)));
debug2(DSC, DD, "Constrained( %s, 1-dim ) = %s",
EchoObject(target), EchoConstraint(&c));
if( !FitsConstraint(0, 0, c) )
{ debug0(DGA, D, " reject: target_galley horizontal constraint is -1");
y = nilobj;
goto REJECT;
}
}
else /* actually unused */
SetConstraint(c, MAX_FULL_LENGTH, MAX_FULL_LENGTH, MAX_FULL_LENGTH);
debug1(DGA, DDD, " expanding %s", EchoObject(target));
tmp = CopyObject(target, no_fpos);
Link(target_galley, tmp);
env = DetachEnv(tmp);
debug4(DGM, D, " external_ver(%s) = %s, external_hor(%s) = %s",
SymName(actual(target)), bool(external_ver(target)),
SymName(actual(target)), bool(external_hor(target)));
SizeGalley(target_galley, env,
external_ver(target) || external_hor(target),
threaded(target), non_blocking(target_index),
trigger_externs(target_index), &save_style(target),
&c, whereto(hd), &dest_index, &recs, &tg_inners,
enclose_obj(hd) != nilobj ? CopyObject(enclose_obj(hd), no_fpos):nilobj);
debug1(DGA, DD, " SizeGalley tg_inners: %s", DebugInnersNames(tg_inners));
if( recs != nilobj ) ExpandRecursives(recs);
dest = actual(dest_index);
if( underline(dest) == UNDER_UNDEF ) underline(dest) = UNDER_OFF;
/* verify that hd satisfies any horizontal constraint on dest */
if( dim == ROWM )
{
debug1(DGA, DDD, " checking hor fit of hd in %s",SymName(actual(dest)));
Constrained(dest, &c, 1-dim, &junk);
debug3(DSC, DD, "Constrained( %s, %s ) = %s",
EchoObject(dest), dimen(1-dim), EchoConstraint(&c));
assert( constrained(c), "AttachGalley: dest unconstrained!" );
if( !FitsConstraint(0, 0, c) )
{ debug0(DGA, D, " reject: hd horizontal constraint is -1");
y = nilobj;
goto REJECT;
}
}
/* manifest and size the galley if not done yet */
if( !sized(hd) )
{
debug2(DYY, D, "[ EnterErrorBlock(TRUE) (sizing galley %s into %s)",
开发者ID:thektulu,项目名称:lout,代码行数:67,代码来源:z19.c
示例19: dump_all_part_state
/* dump_all_part_state - save the state of all partitions to file */
int dump_all_part_state(void)
{
/* Save high-water mark to avoid buffer growth with copies */
static int high_buffer_size = BUF_SIZE;
ListIterator part_iterator;
struct part_record *part_ptr;
int error_code = 0, log_fd;
char *old_file, *new_file, *reg_file;
/* Locks: Read partition */
slurmctld_lock_t part_read_lock =
{ READ_LOCK, NO_LOCK, NO_LOCK, READ_LOCK };
Buf buffer = init_buf(high_buffer_size);
DEF_TIMERS;
START_TIMER;
/* write header: time */
packstr(PART_STATE_VERSION, buffer);
pack_time(time(NULL), buffer);
/* write partition records to buffer */
lock_slurmctld(part_read_lock);
part_iterator = list_iterator_create(part_list);
while ((part_ptr = (struct part_record *) list_next(part_iterator))) {
xassert (part_ptr->magic == PART_MAGIC);
_dump_part_state(part_ptr, buffer);
}
list_iterator_destroy(part_iterator);
old_file = xstrdup(slurmctld_conf.state_save_location);
xstrcat(old_file, "/part_state.old");
reg_file = xstrdup(slurmctld_conf.state_save_location);
xstrcat(reg_file, "/part_state");
new_file = xstrdup(slurmctld_conf.state_save_location);
xstrcat(new_file, "/part_state.new");
unlock_slurmctld(part_read_lock);
/* write the buffer to file */
lock_state_files();
log_fd = creat(new_file, 0600);
if (log_fd < 0) {
error("Can't save state, error creating file %s, %m",
new_file);
error_code = errno;
} else {
int pos = 0, nwrite = get_buf_offset(buffer), amount, rc;
char *data = (char *)get_buf_data(buffer);
high_buffer_size = MAX(nwrite, high_buffer_size);
while (nwrite > 0) {
amount = write(log_fd, &data[pos], nwrite);
if ((amount < 0) && (errno != EINTR)) {
error("Error writing file %s, %m", new_file);
error_code = errno;
break;
}
nwrite -= amount;
pos += amount;
}
rc = fsync_and_close(log_fd, "partition");
if (rc && !error_code)
error_code = rc;
}
if (error_code)
(void) unlink(new_file);
else { /* file shuffle */
(void) unlink(old_file);
if (link(reg_file, old_file)) {
debug4("unable to create link for %s -> %s: %m",
reg_file, old_file);
}
(void) unlink(reg_file);
if (link(new_file, reg_file)) {
debug4("unable to create link for %s -> %s: %m",
new_file, reg_file);
}
(void) unlink(new_file);
}
xfree(old_file);
xfree(reg_file);
xfree(new_file);
unlock_state_files();
free_buf(buffer);
END_TIMER2("dump_all_part_state");
return 0;
}
开发者ID:kwangiit,项目名称:SLURMPP,代码行数:87,代码来源:partition_mgr.c
示例20: addto_update_list
//.........这里部分代码省略.........
switch(type) {
case SLURMDB_MODIFY_USER:
case SLURMDB_ADD_USER:
case SLURMDB_REMOVE_USER:
case SLURMDB_ADD_COORD:
case SLURMDB_REMOVE_COORD:
update_object->objects = list_create(slurmdb_destroy_user_rec);
break;
case SLURMDB_ADD_TRES:
xassert(tres->id);
update_object->objects = list_create(slurmdb_destroy_tres_rec);
break;
case SLURMDB_ADD_ASSOC:
/* We are going to send these to the slurmctld's so
lets set up the correct limits to INFINITE instead
of NO_VAL */
if (assoc->grp_jobs == NO_VAL)
assoc->grp_jobs = INFINITE;
if (assoc->grp_submit_jobs == NO_VAL)
assoc->grp_submit_jobs = INFINITE;
if (assoc->grp_wall == NO_VAL)
assoc->grp_wall = INFINITE;
if (assoc->max_jobs == NO_VAL)
assoc->max_jobs = INFINITE;
if (assoc->max_jobs_accrue == NO_VAL)
assoc->max_jobs_accrue = INFINITE;
if (assoc->min_prio_thresh == NO_VAL)
assoc->min_prio_thresh = INFINITE;
if (assoc->max_submit_jobs == NO_VAL)
assoc->max_submit_jobs = INFINITE;
if (assoc->max_wall_pj == NO_VAL)
assoc->max_wall_pj = INFINITE;
/* fall through */
case SLURMDB_MODIFY_ASSOC:
case SLURMDB_REMOVE_ASSOC:
xassert(assoc->cluster);
update_object->objects = list_create(
slurmdb_destroy_assoc_rec);
break;
case SLURMDB_ADD_QOS:
/* We are going to send these to the slurmctld's so
lets set up the correct limits to INFINITE instead
of NO_VAL */
if (qos->grp_jobs == NO_VAL)
qos->grp_jobs = INFINITE;
if (qos->grp_submit_jobs == NO_VAL)
qos->grp_submit_jobs = INFINITE;
if (qos->grp_wall == NO_VAL)
qos->grp_wall = INFINITE;
if (qos->max_jobs_pu == NO_VAL)
qos->max_jobs_pu = INFINITE;
if (qos->max_submit_jobs_pu == NO_VAL)
qos->max_submit_jobs_pu = INFINITE;
if (qos->max_wall_pj == NO_VAL)
qos->max_wall_pj = INFINITE;
/* fall through */
case SLURMDB_MODIFY_QOS:
case SLURMDB_REMOVE_QOS:
update_object->objects = list_create(
slurmdb_destroy_qos_rec);
break;
case SLURMDB_ADD_WCKEY:
case SLURMDB_MODIFY_WCKEY:
case SLURMDB_REMOVE_WCKEY:
xassert(wckey->cluster);
update_object->objects = list_create(
slurmdb_destroy_wckey_rec);
break;
case SLURMDB_ADD_CLUSTER:
case SLURMDB_REMOVE_CLUSTER:
/* This should only be the name of the cluster, and is
only used in the plugin for rollback purposes.
*/
update_object->objects = list_create(slurm_destroy_char);
break;
case SLURMDB_ADD_RES:
xassert(res->name);
xassert(res->server);
/* fall through */
case SLURMDB_MODIFY_RES:
case SLURMDB_REMOVE_RES:
xassert(res->id != NO_VAL);
update_object->objects = list_create(
slurmdb_destroy_res_rec);
break;
case SLURMDB_UPDATE_FEDS:
update_object->objects = object;
return SLURM_SUCCESS;
case SLURMDB_UPDATE_NOTSET:
default:
error("unknown type set in update_object: %d", type);
return SLURM_ERROR;
}
debug4("XXX: update object with type %d added", type);
list_append(update_object->objects, object);
return SLURM_SUCCESS;
}
开发者ID:SchedMD,项目名称:slurm,代码行数:101,代码来源:common_as.c
注:本文中的debug4函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论