CURLcode Curl_add_handle_to_pipeline(struct SessionHandle *handle, struct connectdata *conn) { struct curl_llist_element *sendhead = conn->send_pipe->head; struct curl_llist *pipeline; CURLcode rc; pipeline = conn->send_pipe; infof(conn->data, "Adding handle: conn: %p\n", (void *)conn); infof(conn->data, "Adding handle: send: %d\n", conn->send_pipe->size); infof(conn->data, "Adding handle: recv: %d\n", conn->recv_pipe->size); rc = Curl_addHandleToPipeline(handle, pipeline); if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { /* this is a new one as head, expire it */ conn->writechannel_inuse = FALSE; /* not in use yet */ #ifdef DEBUGBUILD infof(conn->data, "%p is at send pipe head!\n", (void *)conn->send_pipe->head->ptr); #endif Curl_expire(conn->send_pipe->head->ptr, 1); } print_pipeline(conn); return rc; }
// Cycle structures in reverse order void dnn_sim::cycle(){ m_sim_cycle++; std::cout << std::endl << "Cycle: " << m_sim_cycle << std::endl; check_nb_out_complete(); // Retire completed pipeline operation m_srams[NBout]->cycle(); // Cycle NBout SRAM for write for(int i=(NUM_PIPE_STAGES-1); i>=0; --i){ // Cycle the NFU-# pipeline stages in reverse order m_pipe_stages[i]->cycle(); } m_srams[NBin]->cycle(); // Cycle NBin and SB SRAMs for read m_srams[SB]->cycle(); print_pipeline(); }
int main (int argc, char *argv[]) { mongoc_client_t *client; mongoc_collection_t *collection; mongoc_init (); client = mongoc_client_new ( "mongodb://localhost:27017?appname=aggregation-example"); mongoc_client_set_error_api (client, 2); collection = mongoc_client_get_collection (client, "test", "zipcodes"); print_pipeline (collection); mongoc_collection_destroy (collection); mongoc_client_destroy (client); mongoc_cleanup (); return 0; }
CURLcode Curl_add_handle_to_pipeline(struct SessionHandle *handle, struct connectdata *conn) { struct curl_llist_element *sendhead = conn->send_pipe->head; struct curl_llist *pipeline; CURLcode result; pipeline = conn->send_pipe; result = Curl_addHandleToPipeline(handle, pipeline); if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { /* this is a new one as head, expire it */ conn->writechannel_inuse = FALSE; /* not in use yet */ Curl_expire(conn->send_pipe->head->ptr, 1); } #if 0 /* enable for pipeline debugging */ print_pipeline(conn); #endif return result; }
bool run_a_cycle(memory_c *main_memory){ // please modify run_a_cycle function argument /** NEW-LAB2 */ int i = 0; for (;;) { if (((KNOB(KNOB_MAX_SIM_COUNT)->getValue() && (cycle_count >= KNOB(KNOB_MAX_SIM_COUNT)->getValue())) || (KNOB(KNOB_MAX_INST_COUNT)->getValue() && (retired_instruction >= KNOB(KNOB_MAX_INST_COUNT)->getValue())) || (sim_end_condition))) { // please complete sim_end_condition // finish the simulation print_heartbeat(); print_stats(); return TRUE; } cycle_count++; if (!(cycle_count%5000)) { print_heartbeat(); } main_memory->run_a_cycle(); // *NEW-LAB2 WB_stage(main_memory); MEM_stage(main_memory); // please modify MEM_stage function argument /** NEW-LAB2 */ EX_stage(); ID_stage(); FE_stage(); if (KNOB(KNOB_PRINT_PIPE_FREQ)->getValue() && !(cycle_count%KNOB(KNOB_PRINT_PIPE_FREQ)->getValue())) print_pipeline(); } return TRUE; }
bool run_a_cycle(){ int i = 0; for (;;) { if (((KNOB(KNOB_MAX_SIM_COUNT)->getValue() && (cycle_count >= KNOB(KNOB_MAX_SIM_COUNT)->getValue())) || (KNOB(KNOB_MAX_INST_COUNT)->getValue() && (retired_instruction >= KNOB(KNOB_MAX_INST_COUNT)->getValue())) || (sim_end_condition))) { // please complete sim_end_condition // finish the simulation print_heartbeat(); print_stats(); return TRUE; } cycle_count++; if (!(cycle_count%5000)) { print_heartbeat(); } WB_stage(); MEM_stage(); EX_stage(); ID_stage(); FE_stage(); if (KNOB(KNOB_PRINT_PIPE_FREQ)->getValue() && !(cycle_count%KNOB(KNOB_PRINT_PIPE_FREQ)->getValue())) print_pipeline(); } return TRUE; }
bool run_a_cycle(memory_c *main_memory){ long int retired_instruction_cpy=0; int terminate_count=0; bool terminate_program=false; for (;;) { if ((KNOB(KNOB_MAX_SIM_COUNT)->getValue() && (cycle_count >= KNOB(KNOB_MAX_SIM_COUNT)->getValue())) || (KNOB(KNOB_MAX_INST_COUNT)->getValue() && (retired_instruction >= KNOB(KNOB_MAX_INST_COUNT)->getValue())) || (sim_end_condition) || terminate_program) { // please complete sim_end_condition // finish the simulation print_heartbeat(); print_stats(); return TRUE; } cycle_count++; if (!(cycle_count%5000)) { print_heartbeat(); } /*section to terminate the program if it fails to exit normally*/ if(terminate_count>1000) { if(retired_instruction_cpy==retired_instruction) terminate_program=true; else { retired_instruction_cpy=retired_instruction; terminate_count=0; } } else terminate_count++; /*section to terminate the program if it fails to exit normally*/ main_memory->run_a_cycle(); // *NEW-LAB2 WB_stage(); MEM_stage(main_memory); // please modify MEM_stage function argument /** NEW-LAB2 */ EX_stage(); ID_stage(); FE_stage(); if(trace_over && main_memory->all_mem_structures_empty() && pipeline_latches_empty()) sim_end_condition = true; if (KNOB(KNOB_PRINT_PIPE_FREQ)->getValue() && !(cycle_count%KNOB(KNOB_PRINT_PIPE_FREQ)->getValue())) print_pipeline(); } return TRUE; }